// C++ class jumptables are a pain in the ass. Thankfully half of these opcodes are macros
#define Z80_REGISTER_OPERAND(opcode, function) this->ops[opcode] = &CZ80::function;
#define Z80_CALL_OPERAND    (opcode)           (this->ops[opcode])();

/***************************************************************
 * Enter halt state; write 1 to fake port on first execution.
 * removed from fcn: CPU_BURN_NAME(z80)( (Z)->device, (Z)->icount);			\
 ***************************************************************/
#define ENTER_HALT(Z) do {										\
	PC--;														\
	halt = 1;													\
	if( irq_state == CLEAR_LINE )								\
		Burn(icount);											\
} while (0)

/***************************************************************
 * Leave halt state; write 0 to fake port
 ***************************************************************/
#define LEAVE_HALT(Z) do {										\
	if( halt )												\
	{															\
		halt = 0;											\
		PC++;												\
	}															\
} while (0)


/****************************************************************************/
/* Burn an odd amount of cycles, that is instructions taking something      */
/* different from 4 T-states per opcode (and r increment)              */
/****************************************************************************/
void CZ80::BURNODD(int cycles, int opcodes, int cyclesum)
{
	if( cycles > 0 )
	{
		r += (cycles / cyclesum) * opcodes;
		icount -= (cycles / cyclesum) * cyclesum;
	}
}

/***************************************************************
 * adjust cycle count by n T-states
 ***************************************************************/
#define CC(Z,prefix,opcode)	do { this->icount -= cc_##prefix[opcode]; } while (0)

/***************************************************************
 * execute an opcode
 ***************************************************************/
#define EXEC(Z,prefix,opcode)									\
{																\
	unsigned op = opcode;										\
	CC(Z,prefix,op);											\
	(this->*##prefix##table[op])();										\
}
#define WM(Z,addr,value)	program_space->Write8( addr, value)
#define RM(z,addr)			program_space->Read8(addr)
#define OUT(Z, addr, value) io_space->Write8(addr, value)
#define IN(Z, addr)			io_space->Read8(addr)

UINT8 CZ80::ROP()
{
	unsigned int pc = PC;
	PC++;
	return program_space->ReadOp8(pc); // memory_decrypted_read_byte(program, pc);
}

void CZ80::WM16(UINT32 addr, PAIR *r)
{
	WM(z80, addr, r->b.l);
	WM(z80, (addr+1)&0xffff, r->b.h);
}

void CZ80::RM16(UINT32 addr, PAIR *r)
{
	r->b.l = RM(z80, addr);
	r->b.h = RM(z80, (addr+1)&0xffff);
}


UINT8 CZ80::ARG() {
		UINT32 pc = PC;
		
		UINT8 ret = program_space->Read8(pc);
		//Msg("ARG: %02X\n", ret);
		PC++;
		return ret;
}

UINT32 CZ80::ARG16(){
		UINT32 pc = PC;
		PC += 2;

		UINT16 ret = RM(z80, pc) | (RM(z80, ((pc+1)&0xffff) ) << 8);
		//Msg("ARG16 from %04X: %04X\n",pc,ret);
		return ret;
}

/***************************************************************
 * Calculate the effective address EA of an opcode using
 * IX+offset resp. IY+offset addressing.
 ***************************************************************/
#define EAX(Z) 		do { ea = (UINT32)(UINT16)(IX + (INT8)ARG()); MEMPTR = ea; } while (0)
#define EAY(Z)		do { ea = (UINT32)(UINT16)(IY + (INT8)ARG()); MEMPTR = ea; } while (0)

/***************************************************************
 * POP
 ***************************************************************/
#define POP(Z,DR) 	do { RM16(SPD, &DR); SP += 2; } while (0)

/***************************************************************
 * PUSH
 ***************************************************************/
#define PUSH(Z,SR) 	do { SP -= 2; WM16(SPD, &SR); } while (0)

/***************************************************************
 * JP
 ***************************************************************/
#define JP(Z) do {												\
	PC = ARG16();										\
	MEMPTR = PC;										\
} while (0)

/***************************************************************
 * JP_COND
 ***************************************************************/
#define JP_COND(Z, cond) do {									\
	if (cond)													\
	{															\
		PCD = ARG16();									\
		MEMPTR = PCD;									\
	}															\
	else														\
	{															\
		MEMPTR = ARG16(); /* implicit do PC += 2 */		\
	}															\
} while (0)

/***************************************************************
 * JR
 ***************************************************************/
#define JR(Z) do {												\
	INT8 arg = (INT8)ARG(); 	/* ARG() also increments PC */	\
	PC += arg;				/* so don't do PC += ARG() */	\
	MEMPTR = PC;										\
} while (0)

/***************************************************************
 * JR_COND
 ***************************************************************/
#define JR_COND(Z, cond, opcode) do {							\
	if (cond)													\
	{															\
		JR(Z);													\
		CC(Z, ex, opcode);										\
	}															\
	else PC++;												\
} while (0)

/***************************************************************
 * CALL
 ***************************************************************/
#define CALL(Z) do {											\
	ea = ARG16();											\
	MEMPTR = ea;										\
	PUSH((Z), pc);												\
	PCD = ea;											\
} while (0)

/***************************************************************
 * CALL_COND
 ***************************************************************/
#define CALL_COND(Z, cond, opcode) do {							\
	if (cond)													\
	{															\
		ea = ARG16();										\
		MEMPTR = ea;									\
		PUSH((Z), pc);											\
		PCD = ea;										\
		CC(Z, ex, opcode);										\
	}															\
	else														\
	{															\
		MEMPTR = ARG16();  /* implicit call PC+=2;   */	\
	}															\
} while (0)

/***************************************************************
 * RET_COND
 ***************************************************************/
#define RET_COND(Z, cond, opcode) do {							\
	if (cond)													\
	{															\
		POP((Z), pc);											\
		MEMPTR = PC;									\
		CC(Z, ex, opcode);										\
	}															\
} while (0)

/***************************************************************
 * RETN
 ***************************************************************/
#define RETN do {											\
	POP((Z), pc);												\
	MEMPTR = PC;										\
	iff1 = iff2;										\
} while (0)

/***************************************************************
 * RETI. (TODO: Re-implement daisy chaining)
 ***************************************************************/
#define RETI do {											\
	POP((Z), pc);												\
	MEMPTR = PC;										\
/* according to http://www.msxnet.org/tech/z80-documented.pdf */\
	iff1 = iff2;										\
} while (0)

/***************************************************************
 * LD   R,A
 ***************************************************************/
#define LD_R_A do {											\
	r =  A;											\
	r2 = A & 0x80;			/* keep bit 7 of r */	\
} while (0)

/***************************************************************
 * LD   A,R
 ***************************************************************/
#define LD_A_R do {											\
	A = (r & 0x7f) | r2;							\
	F = (F & CF) | SZ[A] | (iff2 << 2);		\
} while (0)

/***************************************************************
 * LD   I,A
 ***************************************************************/
#define LD_I_A do {											\
	i = A;											\
} while (0)

/***************************************************************
 * LD   A,I
 ***************************************************************/
#define LD_A_I do {											\
	A = i;											\
	F = (F & CF) | SZ[A] | (iff2 << 2);		\
} while (0)

/***************************************************************
 * RST
 ***************************************************************/
#define RST(Z, addr) do {										\
	PUSH((Z), pc);												\
	PCD = addr;											\
	MEMPTR = PC;										\
} while (0)

/***************************************************************
 * INC  r8
 ***************************************************************/
INLINE UINT8 CZ80::INC(UINT8 value)
{
	UINT8 res = value + 1;
	F = (F & CF) | SZHV_inc[res];
	return (UINT8)res;
}

/***************************************************************
 * DEC  r8
 ***************************************************************/
INLINE UINT8 CZ80::DEC(UINT8 value)
{
	UINT8 res = value - 1;
	F = (F & CF) | SZHV_dec[res];
	return res;
}

/***************************************************************
 * RLCA
 ***************************************************************/
#define RLCA(Z) do {											\
	A = (A << 1) | (A >> 7);						\
	F = (F & (SF | ZF | PF)) | (A & (YF | XF | CF)); \
} while (0)

/***************************************************************
 * RRCA
 ***************************************************************/
#define RRCA(Z) do {											\
	F = (F & (SF | ZF | PF)) | (A & CF);			\
	A = (A >> 1) | (A << 7);						\
	F |= (A & (YF | XF));								\
} while (0)

/***************************************************************
 * RLA
 ***************************************************************/
#define RLA(Z) do {												\
	UINT8 res = (A << 1) | (F & CF);					\
	UINT8 c = (A & 0x80) ? CF : 0;							\
	F = (F & (SF | ZF | PF)) | c | (res & (YF | XF));	\
	A = res;												\
} while (0)

/***************************************************************
 * RRA
 ***************************************************************/
#define RRA(Z) do {												\
	UINT8 res = (A >> 1) | (F << 7);					\
	UINT8 c = (A & 0x01) ? CF : 0;							\
	F = (F & (SF | ZF | PF)) | c | (res & (YF | XF));	\
	A = res;												\
} while (0)

/***************************************************************
 * RRD
 ***************************************************************/
#define RRD do {												\
	UINT8 n = RM(Z, HL);									\
	MEMPTR = HL+1;									\
	WM((Z), HL, (n >> 4) | (A << 4));					\
	A = (A & 0xf0) | (n & 0x0f);						\
	F = (F & CF) | SZP[A];						\
} while (0)

/***************************************************************
 * RLD
 ***************************************************************/
#define RLD do {												\
	UINT8 n = RM(Z, HL);									\
	MEMPTR = HL+1;									\
	WM((Z), HL, (n << 4) | (A & 0x0f));				\
	A = (A & 0xf0) | (n >> 4);						\
	F = (F & CF) | SZP[A];						\
} while (0)

/***************************************************************
 * ADD  A,n
 ***************************************************************/
#define ADD(Z, value) do {										\
	UINT32 ah = AFD & 0xff00;								\
	UINT32 res = (UINT8)((ah >> 8) + value);					\
	F = SZHVC_add[ah | res];								\
	A = res;												\
} while (0)

/***************************************************************
 * ADC  A,n
 ***************************************************************/
#define ADC(Z, value) do {										\
	UINT32 ah = AFD & 0xff00, c = AFD & 1;			\
	UINT32 res = (UINT8)((ah >> 8) + value + c);				\
	F = SZHVC_add[(c << 16) | ah | res];					\
	A = res;												\
} while (0)

/***************************************************************
 * SUB  n
 ***************************************************************/
#define SUB(Z, value) do {										\
	UINT32 ah = AFD & 0xff00;								\
	UINT32 res = (UINT8)((ah >> 8) - value);					\
	F = SZHVC_sub[ah | res];								\
	A = res;												\
} while (0)

/***************************************************************
 * SBC  A,n
 ***************************************************************/
#define SBC(Z, value) do {										\
	UINT32 ah = AFD & 0xff00, c = AFD & 1;			\
	UINT32 res = (UINT8)((ah >> 8) - value - c);				\
	F = SZHVC_sub[(c<<16) | ah | res];						\
	A = res;												\
} while (0)

/***************************************************************
 * NEG
 ***************************************************************/
#define NEG do {												\
	UINT8 value = A;										\
	A = 0;													\
	SUB(Z, value);												\
} while (0)

/***************************************************************
 * DAA
 ***************************************************************/
#define DAA(Z) do {												\
	UINT8 cf, nf, hf, lo, hi, diff;								\
	cf = F & CF;											\
	nf = F & NF;											\
	hf = F & HF;											\
	lo = A & 15;											\
	hi = A / 16;											\
																\
	if (cf)														\
		diff = (lo <= 9 && !hf) ? 0x60 : 0x66;					\
	else if (lo >= 10)											\
		diff = hi <= 8 ? 0x06 : 0x66;							\
	else if (hi >= 10)											\
		diff = hf ? 0x66 : 0x60;								\
	else														\
		diff = hf ? 0x06 : 0x00;								\
	if (nf) A -= diff;										\
	else A += diff;										\
																\
	F = SZP[A] | (F & NF);						\
	if (cf || (lo <= 9 ? hi >= 10 : hi >= 9)) F |= CF;		\
	if (nf ? hf && lo <= 5 : lo >= 10)	F |= HF;			\
} while (0)

/***************************************************************
 * AND  n
 ***************************************************************/
#define AND(Z, value) do {										\
	A &= value;											\
	F = SZP[A] | HF;									\
} while (0)

/***************************************************************
 * OR   n
 ***************************************************************/
#define OR(Z, value) do {										\
	A |= value;											\
	F = SZP[A];										\
} while (0)

/***************************************************************
 * XOR  n
 ***************************************************************/
#define XOR(Z, value) do {										\
	A ^= value;											\
	F = SZP[A];										\
} while (0)

/***************************************************************
 * CP   n
 ***************************************************************/
#define CP(Z, value) do {										\
	unsigned val = value;										\
	UINT32 ah = AFD & 0xff00;								\
	UINT32 res = (UINT8)((ah >> 8) - val);						\
	F = (SZHVC_sub[ah | res] & ~(YF | XF)) |				\
		(val & (YF | XF));										\
} while (0)

/***************************************************************
 * EX   AF,AF'
 ***************************************************************/
#define EX_AF(Z) do {											\
	PAIR tmp;													\
	tmp = af; af = af2; af2 = tmp;			\
} while (0)

/***************************************************************
 * EX   DE,HL
 ***************************************************************/
#define EX_DE_HL(Z) do {										\
	PAIR tmp;													\
	tmp = de; de = hl; hl = tmp;			\
} while (0)

/***************************************************************
 * EXX
 ***************************************************************/
#define EXX(Z) do {												\
	PAIR tmp;													\
	tmp = bc; bc = bc2; bc2 = tmp;			\
	tmp = de; de = de2; de2 = tmp;			\
	tmp = hl; hl = hl2; hl2 = tmp;			\
} while (0)

/***************************************************************
 * EX   (SP),r16
 ***************************************************************/
#define EXSP(Z, DR) do {										\
	PAIR tmp = { { 0, 0, 0, 0 } };								\
	RM16(SPD, &tmp);									\
	WM16(SPD, &DR);								\
	DR = tmp;												\
	MEMPTR = DR.d;									\
} while (0)

/***************************************************************
 * ADD16
 ***************************************************************/
#define ADD16(Z, DR, SR) do {									\
	UINT32 res = DR.d + SR.d;							\
	MEMPTR = DR.d + 1;								\
	F = (F & (SF | ZF | VF)) |						\
		(((DR.d ^ res ^ SR.d) >> 8) & HF) |			\
		((res >> 16) & CF) | ((res >> 8) & (YF | XF));			\
	DR.w.l = (UINT16)res;									\
} while (0)

/***************************************************************
 * ADC  r16,r16
 ***************************************************************/
#define ADC16(Z, Reg) do {										\
	UINT32 res = HLD + Reg.d + (F & CF);			\
	MEMPTR = HL + 1;									\
	F = (((HLD ^ res ^ Reg.d) >> 8) & HF) |		\
		((res >> 16) & CF) |									\
		((res >> 8) & (SF | YF | XF)) |							\
		((res & 0xffff) ? 0 : ZF) |								\
		(((Reg.d ^ HLD ^ 0x8000) & (Reg.d ^ res) & 0x8000) >> 13); \
	HL = (UINT16)res;										\
} while (0)

/***************************************************************
 * SBC  r16,r16
 ***************************************************************/
#define SBC16(Z, Reg) do {										\
	UINT32 res = HLD - Reg.d - (F & CF);			\
	MEMPTR = HL + 1;									\
	F = (((HLD ^ res ^ Reg.d) >> 8) & HF) | NF |	\
		((res >> 16) & CF) |									\
		((res >> 8) & (SF | YF | XF)) |							\
		((res & 0xffff) ? 0 : ZF) |								\
		(((Reg.d ^ HLD) & (HLD ^ res) &0x8000) >> 13); \
	HL = (UINT16)res;										\
} while (0)

/***************************************************************
 * RLC  r8
 ***************************************************************/
INLINE UINT8 CZ80::RLC(UINT8 value)
{
	unsigned int res = value;
	unsigned int c = (res & 0x80) ? CF : 0;
	res = ((res << 1) | (res >> 7)) & 0xff;
	F = SZP[res] | c;
	return res;
}

/***************************************************************
 * RRC  r8
 ***************************************************************/
INLINE UINT8 CZ80::RRC(UINT8 value)
{
	unsigned int res = value;
	unsigned int c = (res & 0x01) ? CF : 0;
	res = ((res >> 1) | (res << 7)) & 0xff;
	F = SZP[res] | c;
	return res;
}

/***************************************************************
 * RL   r8
 ***************************************************************/
INLINE UINT8 CZ80::RL(UINT8 value)
{
	unsigned res = value;
	unsigned c = (res & 0x80) ? CF : 0;
	res = ((res << 1) | (F & CF)) & 0xff;
	F = SZP[res] | c;
	return res;
}

/***************************************************************
 * RR   r8
 ***************************************************************/
INLINE UINT8 CZ80::RR(UINT8 value)
{
	unsigned res = value;
	unsigned c = (res & 0x01) ? CF : 0;
	res = ((res >> 1) | (F << 7)) & 0xff;
	F = SZP[res] | c;
	return res;
}

/***************************************************************
 * SLA  r8
 ***************************************************************/
INLINE UINT8 CZ80::SLA(UINT8 value)
{
	unsigned res = value;
	unsigned c = (res & 0x80) ? CF : 0;
	res = (res << 1) & 0xff;
	F = SZP[res] | c;
	return res;
}

/***************************************************************
 * SRA  r8
 ***************************************************************/
INLINE UINT8 CZ80::SRA(UINT8 value)
{
	unsigned res = value;
	unsigned c = (res & 0x01) ? CF : 0;
	res = ((res >> 1) | (res & 0x80)) & 0xff;
	F = SZP[res] | c;
	return res;
}

/***************************************************************
 * SLL  r8
 ***************************************************************/
INLINE UINT8 CZ80::SLL(UINT8 value)
{
	unsigned res = value;
	unsigned c = (res & 0x80) ? CF : 0;
	res = ((res << 1) | 0x01) & 0xff;
	F = SZP[res] | c;
	return res;
}

/***************************************************************
 * SRL  r8
 ***************************************************************/
INLINE UINT8 CZ80::SRL(UINT8 value)
{
	unsigned res = value;
	unsigned c = (res & 0x01) ? CF : 0;
	res = (res >> 1) & 0xff;
	F = SZP[res] | c;
	return res;
}

/***************************************************************
 * BIT  bit,r8
 ***************************************************************/
#undef BIT
#define BIT(Z, bit, reg) do {									\
	F = (F & CF) | HF | SZ_BIT[reg & (1<<bit)];		\
} while (0)

/***************************************************************
 * BIT  bit,(HL)
 ***************************************************************/
#define BIT_HL(Z, bit, reg) do {								\
	F = (F & CF) | HF | (SZ_BIT[reg & (1<<bit)] & ~(YF|XF)) | (MEMPTR_H & (YF|XF)); \
} while (0)

/***************************************************************
 * BIT  bit,(IX/Y+o)
 ***************************************************************/
#define BIT_XY(Z, bit, reg) do {								\
	F = (F & CF) | HF | (SZ_BIT[reg & (1<<bit)] & ~(YF|XF)) | ((ea>>8) & (YF|XF)); \
} while (0)

/***************************************************************
 * RES  bit,r8
 ***************************************************************/
INLINE UINT8 RES(UINT8 bit, UINT8 value)
{
	return value & ~(1<<bit);
}

/***************************************************************
 * SET  bit,r8
 ***************************************************************/
INLINE UINT8 SET(UINT8 bit, UINT8 value)
{
	return value | (1<<bit);
}

/***************************************************************
 * LDI
 ***************************************************************/
#define LDI do {												\
	UINT8 io = RM((Z), HL);								\
	WM((Z), DE, io);										\
	F &= SF | ZF | CF;										\
	if ((A + io) & 0x02) F |= YF; /* bit 1 -> flag 5 */ \
	if ((A + io) & 0x08) F |= XF; /* bit 3 -> flag 3 */ \
	HL++; DE++; BC--;							\
	if(BC) F |= VF;									\
} while (0)

/***************************************************************
 * CPI
 ***************************************************************/
#define CPI do {												\
	UINT8 val = RM((Z), HL);								\
	UINT8 res = A - val;									\
	MEMPTR++;												\
	HL++; BC--;										\
	F = (F & CF) | (SZ[res]&~(YF|XF)) | ((A^val^res)&HF) | NF; \
	if (F & HF) res -= 1;									\
	if (res & 0x02) F |= YF; /* bit 1 -> flag 5 */			\
	if (res & 0x08) F |= XF; /* bit 3 -> flag 3 */			\
	if (BC) F |= VF;									\
} while (0)

/***************************************************************
 * INI
 ***************************************************************/
#define INI do {												\
	unsigned t;													\
	UINT8 io = IN((Z), BC);								\
	MEMPTR = BC + 1;									\
	B--;													\
	WM((Z), HL, io);										\
	HL++;													\
	F = SZ[B];										\
	t = (unsigned)((C + 1) & 0xff) + (unsigned)io;			\
	if (io & SF) F |= NF;									\
	if (t & 0x100) F |= HF | CF;							\
	F |= SZP[(UINT8)(t & 0x07) ^ B] & PF;				\
} while (0)

/***************************************************************
 * OUTI
 ***************************************************************/
#define OUTI do {											\
	unsigned t;													\
	UINT8 io = RM((Z), HL);								\
	B--;													\
	MEMPTR = BC + 1;									\
	OUT((Z), BC, io);										\
	HL++;													\
	F = SZ[B];										\
	t = (unsigned)L + (unsigned)io;						\
	if (io & SF) F |= NF;									\
	if (t & 0x100) F |= HF | CF;							\
	F |= SZP[(UINT8)(t & 0x07) ^ B] & PF;				\
} while (0)

/***************************************************************
 * LDD
 ***************************************************************/
#define LDD do {												\
	UINT8 io = RM((Z), HL);								\
	WM((Z), DE, io);										\
	F &= SF | ZF | CF;										\
	if ((A + io) & 0x02) F |= YF; /* bit 1 -> flag 5 */ \
	if ((A + io) & 0x08) F |= XF; /* bit 3 -> flag 3 */ \
	HL--; DE--; BC--;							\
	if (BC) F |= VF;									\
} while (0)

/***************************************************************
 * CPD
 ***************************************************************/
#define CPD do {												\
	UINT8 val = RM((Z), HL);								\
	UINT8 res = A - val;									\
	MEMPTR--;												\
	HL--; BC--;										\
	F = (F & CF) | (SZ[res]&~(YF|XF)) | ((A^val^res)&HF) | NF; \
	if (F & HF) res -= 1;									\
	if (res & 0x02) F |= YF; /* bit 1 -> flag 5 */			\
	if (res & 0x08) F |= XF; /* bit 3 -> flag 3 */			\
	if (BC) F |= VF;									\
} while (0)

/***************************************************************
 * IND
 ***************************************************************/
#define IND do {												\
	unsigned int t;													\
	UINT8 io = IN((Z), BC);								\
	MEMPTR = BC - 1;									\
	B--;													\
	WM((Z), HL, io);										\
	HL--;													\
	F = SZ[B];										\
	t = ((unsigned)(C - 1) & 0xff) + (unsigned)io;			\
	if (io & SF) F |= NF;									\
	if (t & 0x100) F |= HF | CF;							\
	F |= SZP[(UINT8)(t & 0x07) ^ B] & PF;				\
} while (0)

/***************************************************************
 * OUTD
 ***************************************************************/
#define OUTD do {											\
	unsigned t;													\
	UINT8 io = RM((Z), HL);								\
	B--;													\
	MEMPTR = BC - 1;									\
	OUT((Z), BC, io);										\
	HL--;													\
	F = SZ[B];										\
	t = (unsigned)L + (unsigned)io;						\
	if (io & SF) F |= NF;									\
	if (t & 0x100) F |= HF | CF;							\
	F |= SZP[(UINT8)(t & 0x07) ^ B] & PF;				\
} while (0)

/***************************************************************
 * LDIR
 ***************************************************************/
#define LDIR do {											\
	LDI;														\
	if (BC != 0)											\
	{															\
		PC -= 2;											\
		MEMPTR = PC + 1;								\
		CC(Z, ex, 0xb0);										\
	}															\
} while (0)

/***************************************************************
 * CPIR
 ***************************************************************/
#define CPIR do {											\
	CPI;														\
	if (BC != 0 && !(F & ZF))							\
	{															\
		PC -= 2;											\
		MEMPTR = PC + 1;								\
		CC(Z, ex, 0xb1);										\
	}															\
} while (0)

/***************************************************************
 * INIR
 ***************************************************************/
#define INIR do {											\
	INI;														\
	if (B != 0)											\
	{															\
		PC -= 2;											\
		CC(Z, ex, 0xb2);										\
	}															\
} while (0)

/***************************************************************
 * OTIR
 ***************************************************************/
#define OTIR do {											\
	OUTI;													\
	if (B != 0)											\
	{															\
		PC -= 2;											\
		CC(Z, ex, 0xb3);										\
	}															\
} while (0)

/***************************************************************
 * LDDR
 ***************************************************************/
#define LDDR do {											\
	LDD;														\
	if (BC != 0)											\
	{															\
		PC -= 2;											\
		MEMPTR = PC + 1;								\
		CC(Z, ex, 0xb8);										\
	}															\
} while (0)

/***************************************************************
 * CPDR
 ***************************************************************/
#define CPDR do {											\
	CPD;														\
	if (BC != 0 && !(F & ZF))							\
	{															\
		PC -= 2;											\
		MEMPTR = PC + 1;								\
		CC(Z, ex, 0xb9);										\
	}															\
} while (0)

/***************************************************************
 * INDR
 ***************************************************************/
#define INDR do {											\
	IND;														\
	if (B != 0)											\
	{															\
		PC -= 2;											\
		CC(Z, ex, 0xba);										\
	}															\
} while (0)

/***************************************************************
 * OTDR
 ***************************************************************/
#define OTDR do {											\
	OUTD;													\
	if (B != 0)											\
	{															\
		PC -= 2;											\
		CC(Z, ex, 0xbb);										\
	}															\
} while (0)

/***************************************************************
 * EI
 ***************************************************************/
#define EI(Z) do {												\
	iff1 = iff2 = 1;									\
	after_ei = TRUE;										\
} while (0)

/***************************************************************************
						Every single opcode
/**************************************************************************/

/********************************************************************************
** Opcodes with "dd" prefix. Illegal opcodes are mapped to CZ80::IllegalOpcode()
********************************************************************************//**********************************************************
 * IX register related opcodes (DD prefix)
 **********************************************************/
OP(dd,00) { IllegalOpcode(0xdd); op_00();								} /* DB   DD          */
OP(dd,01) { IllegalOpcode(0xdd); op_01();								} /* DB   DD          */
OP(dd,02) { IllegalOpcode(0xdd); op_02();								} /* DB   DD          */
OP(dd,03) { IllegalOpcode(0xdd); op_03();								} /* DB   DD          */
OP(dd,04) { IllegalOpcode(0xdd); op_04();								} /* DB   DD          */
OP(dd,05) { IllegalOpcode(0xdd); op_05();								} /* DB   DD          */
OP(dd,06) { IllegalOpcode(0xdd); op_06();								} /* DB   DD          */
OP(dd,07) { IllegalOpcode(0xdd); op_07();								} /* DB   DD          */

OP(dd,08) { IllegalOpcode(0xdd); op_08();								} /* DB   DD          */
OP(dd,09) { ADD16(Z, ix, bc);									} /* ADD  IX,BC       */
OP(dd,0a) { IllegalOpcode(0xdd); op_0a();								} /* DB   DD          */
OP(dd,0b) { IllegalOpcode(0xdd); op_0b();								} /* DB   DD          */
OP(dd,0c) { IllegalOpcode(0xdd); op_0c();								} /* DB   DD          */
OP(dd,0d) { IllegalOpcode(0xdd); op_0d();								} /* DB   DD          */
OP(dd,0e) { IllegalOpcode(0xdd); op_0e();								} /* DB   DD          */
OP(dd,0f) { IllegalOpcode(0xdd); op_0f();								} /* DB   DD          */

OP(dd,10) { IllegalOpcode(0xdd); op_10();								} /* DB   DD          */
OP(dd,11) { IllegalOpcode(0xdd); op_11();								} /* DB   DD          */
OP(dd,12) { IllegalOpcode(0xdd); op_12();								} /* DB   DD          */
OP(dd,13) { IllegalOpcode(0xdd); op_13();								} /* DB   DD          */
OP(dd,14) { IllegalOpcode(0xdd); op_14();								} /* DB   DD          */
OP(dd,15) { IllegalOpcode(0xdd); op_15();								} /* DB   DD          */
OP(dd,16) { IllegalOpcode(0xdd); op_16();								} /* DB   DD          */
OP(dd,17) { IllegalOpcode(0xdd); op_17();								} /* DB   DD          */

OP(dd,18) { IllegalOpcode(0xdd); op_18();								} /* DB   DD          */
OP(dd,19) { ADD16(Z, ix,de);									} /* ADD  IX,DE       */
OP(dd,1a) { IllegalOpcode(0xdd); op_1a();								} /* DB   DD          */
OP(dd,1b) { IllegalOpcode(0xdd); op_1b();								} /* DB   DD          */
OP(dd,1c) { IllegalOpcode(0xdd); op_1c();								} /* DB   DD          */
OP(dd,1d) { IllegalOpcode(0xdd); op_1d();								} /* DB   DD          */
OP(dd,1e) { IllegalOpcode(0xdd); op_1e();								} /* DB   DD          */
OP(dd,1f) { IllegalOpcode(0xdd); op_1f();								} /* DB   DD          */

OP(dd,20) { IllegalOpcode(0xdd); op_20();								} /* DB   DD          */
OP(dd,21) { IX = ARG16();									} /* LD   IX,w        */
OP(dd,22) { EA = ARG16(); WM16( EA, &ix );				} /* LD   (w),IX      */
OP(dd,23) { IX++;											} /* INC  IX          */
OP(dd,24) { HX = INC(HX);									} /* INC  HX          */
OP(dd,25) { HX = DEC(HX);									} /* DEC  HX          */
OP(dd,26) { HX = ARG();									} /* LD   HX,n        */
OP(dd,27) { IllegalOpcode(0xdd); op_27();								} /* DB   DD          */

OP(dd,28) { IllegalOpcode(0xdd); op_28();								} /* DB   DD          */
OP(dd,29) { ADD16(Z,ix,ix);									} /* ADD  IX,IX       */
OP(dd,2a) { EA = ARG16(); RM16( EA, &ix );				} /* LD   IX,(w)      */
OP(dd,2b) { IX--;											} /* DEC  IX          */
OP(dd,2c) { LX = INC(LX);									} /* INC  LX          */
OP(dd,2d) { LX = DEC(LX);									} /* DEC  LX          */
OP(dd,2e) { LX = ARG();									} /* LD   LX,n        */
OP(dd,2f) { IllegalOpcode(0xdd); op_2f();								} /* DB   DD          */

OP(dd,30) { IllegalOpcode(0xdd); op_30();								} /* DB   DD          */
OP(dd,31) { IllegalOpcode(0xdd); op_31();								} /* DB   DD          */
OP(dd,32) { IllegalOpcode(0xdd); op_32();								} /* DB   DD          */
OP(dd,33) { IllegalOpcode(0xdd); op_33();								} /* DB   DD          */
OP(dd,34) { EAX(Z); WM( Z, EA, INC(RM(Z,EA)) );					} /* INC  (IX+o)      */
OP(dd,35) { EAX(Z); WM( Z, EA, DEC(RM(Z,EA)) );					} /* DEC  (IX+o)      */
OP(dd,36) { EAX(Z); WM( Z, EA, ARG() );							} /* LD   (IX+o),n    */
OP(dd,37) { IllegalOpcode(0xdd); op_37();								} /* DB   DD          */

OP(dd,38) { IllegalOpcode(0xdd); op_38();								} /* DB   DD          */
OP(dd,39) { ADD16(Z, ix,sp);									} /* ADD  IX,SP       */
OP(dd,3a) { IllegalOpcode(0xdd); op_3a();								} /* DB   DD          */
OP(dd,3b) { IllegalOpcode(0xdd); op_3b();								} /* DB   DD          */
OP(dd,3c) { IllegalOpcode(0xdd); op_3c();								} /* DB   DD          */
OP(dd,3d) { IllegalOpcode(0xdd); op_3d();								} /* DB   DD          */
OP(dd,3e) { IllegalOpcode(0xdd); op_3e();								} /* DB   DD          */
OP(dd,3f) { IllegalOpcode(0xdd); op_3f();								} /* DB   DD          */

OP(dd,40) { IllegalOpcode(0xdd); op_40();								} /* DB   DD          */
OP(dd,41) { IllegalOpcode(0xdd); op_41();								} /* DB   DD          */
OP(dd,42) { IllegalOpcode(0xdd); op_42();								} /* DB   DD          */
OP(dd,43) { IllegalOpcode(0xdd); op_43();								} /* DB   DD          */
OP(dd,44) { B = HX;										} /* LD   B,HX        */
OP(dd,45) { B = LX;										} /* LD   B,LX        */
OP(dd,46) { EAX(Z); B = RM(Z, EA);								} /* LD   B,(IX+o)    */
OP(dd,47) { IllegalOpcode(0xdd); op_47();								} /* DB   DD          */

OP(dd,48) { IllegalOpcode(0xdd); op_48();								} /* DB   DD          */
OP(dd,49) { IllegalOpcode(0xdd); op_49();								} /* DB   DD          */
OP(dd,4a) { IllegalOpcode(0xdd); op_4a();								} /* DB   DD          */
OP(dd,4b) { IllegalOpcode(0xdd); op_4b();								} /* DB   DD          */
OP(dd,4c) { C = HX;										} /* LD   C,HX        */
OP(dd,4d) { C = LX;										} /* LD   C,LX        */
OP(dd,4e) { EAX(Z); C = RM(Z, EA);								} /* LD   C,(IX+o)    */
OP(dd,4f) { IllegalOpcode(0xdd); op_4f();								} /* DB   DD          */

OP(dd,50) { IllegalOpcode(0xdd); op_50();								} /* DB   DD          */
OP(dd,51) { IllegalOpcode(0xdd); op_51();								} /* DB   DD          */
OP(dd,52) { IllegalOpcode(0xdd); op_52();								} /* DB   DD          */
OP(dd,53) { IllegalOpcode(0xdd); op_53();								} /* DB   DD          */
OP(dd,54) { D = HX;										} /* LD   D,HX        */
OP(dd,55) { D = LX;										} /* LD   D,LX        */
OP(dd,56) { EAX(Z); D = RM(Z, EA);								} /* LD   D,(IX+o)    */
OP(dd,57) { IllegalOpcode(0xdd); op_57();								} /* DB   DD          */

OP(dd,58) { IllegalOpcode(0xdd); op_58();								} /* DB   DD          */
OP(dd,59) { IllegalOpcode(0xdd); op_59();								} /* DB   DD          */
OP(dd,5a) { IllegalOpcode(0xdd); op_5a();								} /* DB   DD          */
OP(dd,5b) { IllegalOpcode(0xdd); op_5b();								} /* DB   DD          */
OP(dd,5c) { E = HX;										} /* LD   E,HX        */
OP(dd,5d) { E = LX;										} /* LD   E,LX        */
OP(dd,5e) { EAX(Z); E = RM(Z, EA);								} /* LD   E,(IX+o)    */
OP(dd,5f) { IllegalOpcode(0xdd); op_5f();								} /* DB   DD          */

OP(dd,60) { HX = B;										} /* LD   HX,B        */
OP(dd,61) { HX = C;										} /* LD   HX,C        */
OP(dd,62) { HX = D;										} /* LD   HX,D        */
OP(dd,63) { HX = E;										} /* LD   HX,E        */
OP(dd,64) {														} /* LD   HX,HX       */
OP(dd,65) { HX = LX;										} /* LD   HX,LX       */
OP(dd,66) { EAX(Z); H = RM(Z, EA);								} /* LD   H,(IX+o)    */
OP(dd,67) { HX = A;										} /* LD   HX,A        */

OP(dd,68) { LX = B;										} /* LD   LX,B        */
OP(dd,69) { LX = C;										} /* LD   LX,C        */
OP(dd,6a) { LX = D;										} /* LD   LX,D        */
OP(dd,6b) { LX = E;										} /* LD   LX,E        */
OP(dd,6c) { LX = HX;										} /* LD   LX,HX       */
OP(dd,6d) {														} /* LD   LX,LX       */
OP(dd,6e) { EAX(Z); L = RM(Z, EA);								} /* LD   L,(IX+o)    */
OP(dd,6f) { LX = A;										} /* LD   LX,A        */

OP(dd,70) { EAX(Z); WM( Z, EA, B );								} /* LD   (IX+o),B    */
OP(dd,71) { EAX(Z); WM( Z,EA, C );								} /* LD   (IX+o),C    */
OP(dd,72) { EAX(Z); WM( Z,EA, D );								} /* LD   (IX+o),D    */
OP(dd,73) { EAX(Z); WM(Z, EA, E );								} /* LD   (IX+o),E    */
OP(dd,74) { EAX(Z); WM(Z, EA, H );								} /* LD   (IX+o),H    */
OP(dd,75) { EAX(Z); WM( Z,EA, L );								} /* LD   (IX+o),L    */
OP(dd,76) { IllegalOpcode(0xdd); op_76();								} /* DB   DD          */
OP(dd,77) { EAX(Z); WM( Z,EA, A );								} /* LD   (IX+o),A    */

OP(dd,78) { IllegalOpcode(0xdd); op_78();								} /* DB   DD          */
OP(dd,79) { IllegalOpcode(0xdd); op_79();								} /* DB   DD          */
OP(dd,7a) { IllegalOpcode(0xdd); op_7a();								} /* DB   DD          */
OP(dd,7b) { IllegalOpcode(0xdd); op_7b();								} /* DB   DD          */
OP(dd,7c) { A = HX;										} /* LD   A,HX        */
OP(dd,7d) { A = LX;										} /* LD   A,LX        */
OP(dd,7e) { EAX(Z); A = RM(Z,EA);								} /* LD   A,(IX+o)    */
OP(dd,7f) { IllegalOpcode(0xdd); op_7f();								} /* DB   DD          */

OP(dd,80) { IllegalOpcode(0xdd); op_80();								} /* DB   DD          */
OP(dd,81) { IllegalOpcode(0xdd); op_81();								} /* DB   DD          */
OP(dd,82) { IllegalOpcode(0xdd); op_82();								} /* DB   DD          */
OP(dd,83) { IllegalOpcode(0xdd); op_83();								} /* DB   DD          */
OP(dd,84) { ADD(Z,HX);										} /* ADD  A,HX        */
OP(dd,85) { ADD(Z,LX);										} /* ADD  A,LX        */
OP(dd,86) { EAX(Z); ADD(Z,RM(Z,EA));								} /* ADD  A,(IX+o)    */
OP(dd,87) { IllegalOpcode(0xdd); op_87();								} /* DB   DD          */

OP(dd,88) { IllegalOpcode(0xdd); op_88();								} /* DB   DD          */
OP(dd,89) { IllegalOpcode(0xdd); op_89();								} /* DB   DD          */
OP(dd,8a) { IllegalOpcode(0xdd); op_8a();								} /* DB   DD          */
OP(dd,8b) { IllegalOpcode(0xdd); op_8b();								} /* DB   DD          */
OP(dd,8c) { ADC(Z,HX);										} /* ADC  A,HX        */
OP(dd,8d) { ADC(Z,LX);										} /* ADC  A,LX        */
OP(dd,8e) { EAX(Z); ADC(Z,RM(Z,EA));								} /* ADC  A,(IX+o)    */
OP(dd,8f) { IllegalOpcode(0xdd); op_8f();								} /* DB   DD          */

OP(dd,90) { IllegalOpcode(0xdd); op_90();								} /* DB   DD          */
OP(dd,91) { IllegalOpcode(0xdd); op_91();								} /* DB   DD          */
OP(dd,92) { IllegalOpcode(0xdd); op_92();								} /* DB   DD          */
OP(dd,93) { IllegalOpcode(0xdd); op_93();								} /* DB   DD          */
OP(dd,94) { SUB(Z,HX);										} /* SUB  HX          */
OP(dd,95) { SUB(Z,LX);										} /* SUB  LX          */
OP(dd,96) { EAX(Z); SUB(Z,RM(Z,EA));								} /* SUB  (IX+o)      */
OP(dd,97) { IllegalOpcode(0xdd); op_97();								} /* DB   DD          */

OP(dd,98) { IllegalOpcode(0xdd); op_98();								} /* DB   DD          */
OP(dd,99) { IllegalOpcode(0xdd); op_99();								} /* DB   DD          */
OP(dd,9a) { IllegalOpcode(0xdd); op_9a();								} /* DB   DD          */
OP(dd,9b) { IllegalOpcode(0xdd); op_9b();								} /* DB   DD          */
OP(dd,9c) { SBC(Z,HX);										} /* SBC  A,HX        */
OP(dd,9d) { SBC(Z,LX);										} /* SBC  A,LX        */
OP(dd,9e) { EAX(Z); SBC(Z,RM(Z,EA));								} /* SBC  A,(IX+o)    */
OP(dd,9f) { IllegalOpcode(0xdd); op_9f();								} /* DB   DD          */

OP(dd,a0) { IllegalOpcode(0xdd); op_a0();								} /* DB   DD          */
OP(dd,a1) { IllegalOpcode(0xdd); op_a1();								} /* DB   DD          */
OP(dd,a2) { IllegalOpcode(0xdd); op_a2();								} /* DB   DD          */
OP(dd,a3) { IllegalOpcode(0xdd); op_a3();								} /* DB   DD          */
OP(dd,a4) { AND(Z,HX);										} /* AND  HX          */
OP(dd,a5) { AND(Z,LX);										} /* AND  LX          */
OP(dd,a6) { EAX(Z); AND(Z,RM(Z,EA));								} /* AND  (IX+o)      */
OP(dd,a7) { IllegalOpcode(0xdd); op_a7();								} /* DB   DD          */

OP(dd,a8) { IllegalOpcode(0xdd); op_a8();								} /* DB   DD          */
OP(dd,a9) { IllegalOpcode(0xdd); op_a9();								} /* DB   DD          */
OP(dd,aa) { IllegalOpcode(0xdd); op_aa();								} /* DB   DD          */
OP(dd,ab) { IllegalOpcode(0xdd); op_ab();								} /* DB   DD          */
OP(dd,ac) { XOR(Z,HX);										} /* XOR  HX          */
OP(dd,ad) { XOR(Z,LX);										} /* XOR  LX          */
OP(dd,ae) { EAX(Z); XOR(Z,RM(Z,EA));								} /* XOR  (IX+o)      */
OP(dd,af) { IllegalOpcode(0xdd); op_af();								} /* DB   DD          */

OP(dd,b0) { IllegalOpcode(0xdd); op_b0();								} /* DB   DD          */
OP(dd,b1) { IllegalOpcode(0xdd); op_b1();								} /* DB   DD          */
OP(dd,b2) { IllegalOpcode(0xdd); op_b2();								} /* DB   DD          */
OP(dd,b3) { IllegalOpcode(0xdd); op_b3();								} /* DB   DD          */
OP(dd,b4) { OR(Z,HX);										} /* OR   HX          */
OP(dd,b5) { OR(Z,LX);										} /* OR   LX          */
OP(dd,b6) { EAX(Z); OR(Z,RM(Z,EA));								} /* OR   (IX+o)      */
OP(dd,b7) { IllegalOpcode(0xdd); op_b7();								} /* DB   DD          */

OP(dd,b8) { IllegalOpcode(0xdd); op_b8();								} /* DB   DD          */
OP(dd,b9) { IllegalOpcode(0xdd); op_b9();								} /* DB   DD          */
OP(dd,ba) { IllegalOpcode(0xdd); op_ba();								} /* DB   DD          */
OP(dd,bb) { IllegalOpcode(0xdd); op_bb();								} /* DB   DD          */
OP(dd,bc) { CP(Z,HX);										} /* CP   HX          */
OP(dd,bd) { CP(Z,LX);										} /* CP   LX          */
OP(dd,be) { EAX(Z); CP(Z,RM(Z,EA));								} /* CP   (IX+o)      */
OP(dd,bf) { IllegalOpcode(0xdd); op_bf();								} /* DB   DD          */

OP(dd,c0) { IllegalOpcode(0xdd); op_c0();								} /* DB   DD          */
OP(dd,c1) { IllegalOpcode(0xdd); op_c1();								} /* DB   DD          */
OP(dd,c2) { IllegalOpcode(0xdd); op_c2();								} /* DB   DD          */
OP(dd,c3) { IllegalOpcode(0xdd); op_c3();								} /* DB   DD          */
OP(dd,c4) { IllegalOpcode(0xdd); op_c4();								} /* DB   DD          */
OP(dd,c5) { IllegalOpcode(0xdd); op_c5();								} /* DB   DD          */
OP(dd,c6) { IllegalOpcode(0xdd); op_c6();								} /* DB   DD          */
OP(dd,c7) { IllegalOpcode(0xdd); op_c7();								}		  /* DB   DD          */

OP(dd,c8) { IllegalOpcode(0xdd); op_c8();								} /* DB   DD          */
OP(dd,c9) { IllegalOpcode(0xdd); op_c9();								} /* DB   DD          */
OP(dd,ca) { IllegalOpcode(0xdd); op_ca();								} /* DB   DD          */
OP(dd,cb) { EAX(Z); EXEC(Z,xycb,ARG());							} /* **   DD CB xx    */
OP(dd,cc) { IllegalOpcode(0xdd); op_cc();								} /* DB   DD          */
OP(dd,cd) { IllegalOpcode(0xdd); op_cd();								} /* DB   DD          */
OP(dd,ce) { IllegalOpcode(0xdd); op_ce();								} /* DB   DD          */
OP(dd,cf) { IllegalOpcode(0xdd); op_cf();								} /* DB   DD          */

OP(dd,d0) { IllegalOpcode(0xdd); op_d0();								} /* DB   DD          */
OP(dd,d1) { IllegalOpcode(0xdd); op_d1();								} /* DB   DD          */
OP(dd,d2) { IllegalOpcode(0xdd); op_d2();								} /* DB   DD          */
OP(dd,d3) { IllegalOpcode(0xdd); op_d3();								} /* DB   DD          */
OP(dd,d4) { IllegalOpcode(0xdd); op_d4();								} /* DB   DD          */
OP(dd,d5) { IllegalOpcode(0xdd); op_d5();								} /* DB   DD          */
OP(dd,d6) { IllegalOpcode(0xdd); op_d6();								} /* DB   DD          */
OP(dd,d7) { IllegalOpcode(0xdd); op_d7();								} /* DB   DD          */

OP(dd,d8) { IllegalOpcode(0xdd); op_d8();								} /* DB   DD          */
OP(dd,d9) { IllegalOpcode(0xdd); op_d9();								} /* DB   DD          */
OP(dd,da) { IllegalOpcode(0xdd); op_da();								} /* DB   DD          */
OP(dd,db) { IllegalOpcode(0xdd); op_db();								} /* DB   DD          */
OP(dd,dc) { IllegalOpcode(0xdd); op_dc();								} /* DB   DD          */
OP(dd,dd) { IllegalOpcode(0xdd); op_dd();								} /* DB   DD          */
OP(dd,de) { IllegalOpcode(0xdd); op_de();								} /* DB   DD          */
OP(dd,df) { IllegalOpcode(0xdd); op_df();								} /* DB   DD          */

OP(dd,e0) { IllegalOpcode(0xdd); op_e0();								} /* DB   DD          */
OP(dd,e1) { POP(Z, ix );										} /* POP  IX          */
OP(dd,e2) { IllegalOpcode(0xdd); op_e2();								} /* DB   DD          */
OP(dd,e3) { EXSP( Z, ix );									} /* EX   (SP),IX     */
OP(dd,e4) { IllegalOpcode(0xdd); op_e4();								} /* DB   DD          */
OP(dd,e5) { PUSH( Z,ix );									} /* PUSH IX          */
OP(dd,e6) { IllegalOpcode(0xdd); op_e6();								} /* DB   DD          */
OP(dd,e7) { IllegalOpcode(0xdd); op_e7();								} /* DB   DD          */

OP(dd,e8) { IllegalOpcode(0xdd); op_e8();								} /* DB   DD          */
OP(dd,e9) { PC = IX; change_pc(PCD);						} /* JP   (IX)        */
OP(dd,ea) { IllegalOpcode(0xdd); op_ea();								} /* DB   DD          */
OP(dd,eb) { IllegalOpcode(0xdd); op_eb();								} /* DB   DD          */
OP(dd,ec) { IllegalOpcode(0xdd); op_ec();								} /* DB   DD          */
OP(dd,ed) { IllegalOpcode(0xdd); op_ed();								} /* DB   DD          */
OP(dd,ee) { IllegalOpcode(0xdd); op_ee();								} /* DB   DD          */
OP(dd,ef) { IllegalOpcode(0xdd); op_ef();								} /* DB   DD          */

OP(dd,f0) { IllegalOpcode(0xdd); op_f0();								} /* DB   DD          */
OP(dd,f1) { IllegalOpcode(0xdd); op_f1();								} /* DB   DD          */
OP(dd,f2) { IllegalOpcode(0xdd); op_f2();								} /* DB   DD          */
OP(dd,f3) { IllegalOpcode(0xdd); op_f3();								} /* DB   DD          */
OP(dd,f4) { IllegalOpcode(0xdd); op_f4();								} /* DB   DD          */
OP(dd,f5) { IllegalOpcode(0xdd); op_f5();								} /* DB   DD          */
OP(dd,f6) { IllegalOpcode(0xdd); op_f6();								} /* DB   DD          */
OP(dd,f7) { IllegalOpcode(0xdd); op_f7();								} /* DB   DD          */

OP(dd,f8) { IllegalOpcode(0xdd); op_f8();								} /* DB   DD          */
OP(dd,f9) { SP = IX;										} /* LD   SP,IX       */
OP(dd,fa) { IllegalOpcode(0xdd); op_fa();								} /* DB   DD          */
OP(dd,fb) { IllegalOpcode(0xdd); op_fb();								} /* DB   DD          */
OP(dd,fc) { IllegalOpcode(0xdd); op_fc();								} /* DB   DD          */
OP(dd,fd) { IllegalOpcode(0xdd); op_fd();								} /* DB   DD          */
OP(dd,fe) { IllegalOpcode(0xdd); op_fe();								} /* DB   DD          */
OP(dd,ff) { IllegalOpcode(0xdd); op_ff();								} /* DB   DD          */

OP(xycb,00) { B = RLC(RM(z80, ea)); WM(z80, ea,B);			} /* RLC  B=(XY+o)    */
OP(xycb,01) { C = RLC(RM(z80, ea)); WM(z80, ea,C);			} /* RLC  C=(XY+o)    */
OP(xycb,02) { D = RLC(RM(z80, ea)); WM(z80, ea,D);			} /* RLC  D=(XY+o)    */
OP(xycb,03) { E = RLC(RM(z80, ea)); WM(z80, ea,E);			} /* RLC  E=(XY+o)    */
OP(xycb,04) { H = RLC(RM(z80, ea)); WM(z80, ea,H);			} /* RLC  H=(XY+o)    */
OP(xycb,05) { L = RLC(RM(z80, ea)); WM(z80, ea,L);			} /* RLC  L=(XY+o)    */
OP(xycb,06) { WM(z80, ea, RLC(RM(z80, ea)));							} /* RLC  (XY+o)      */
OP(xycb,07) { A = RLC(RM(z80, ea)); WM(z80, ea,A);			} /* RLC  A=(XY+o)    */

OP(xycb,08) { B = RRC(RM(z80, ea)); WM(z80, ea,B);			} /* RRC  B=(XY+o)    */
OP(xycb,09) { C = RRC(RM(z80, ea)); WM(z80, ea,C);			} /* RRC  C=(XY+o)    */
OP(xycb,0a) { D = RRC(RM(z80, ea)); WM(z80, ea,D);			} /* RRC  D=(XY+o)    */
OP(xycb,0b) { E = RRC(RM(z80, ea)); WM(z80, ea,E);			} /* RRC  E=(XY+o)    */
OP(xycb,0c) { H = RRC(RM(z80, ea)); WM(z80, ea,H);			} /* RRC  H=(XY+o)    */
OP(xycb,0d) { L = RRC(RM(z80, ea)); WM(z80, ea,L);			} /* RRC  L=(XY+o)    */
OP(xycb,0e) { WM(z80, ea,RRC(RM(z80, ea)));							} /* RRC  (XY+o)      */
OP(xycb,0f) { A = RRC(RM(z80, ea)); WM(z80, ea,A);			} /* RRC  A=(XY+o)    */

OP(xycb,10) { B = RL(RM(z80, ea)); WM(z80, ea,B);			} /* RL   B=(XY+o)    */
OP(xycb,11) { C = RL(RM(z80, ea)); WM(z80, ea,C);			} /* RL   C=(XY+o)    */
OP(xycb,12) { D = RL(RM(z80, ea)); WM(z80, ea,D);			} /* RL   D=(XY+o)    */
OP(xycb,13) { E = RL(RM(z80, ea)); WM(z80, ea,E);			} /* RL   E=(XY+o)    */
OP(xycb,14) { H = RL(RM(z80, ea)); WM(z80, ea,H);			} /* RL   H=(XY+o)    */
OP(xycb,15) { L = RL(RM(z80, ea)); WM(z80, ea,L);			} /* RL   L=(XY+o)    */
OP(xycb,16) { WM(z80, ea,RL(RM(z80, ea)));							} /* RL   (XY+o)      */
OP(xycb,17) { A = RL(RM(z80, ea)); WM(z80, ea,A);			} /* RL   A=(XY+o)    */

OP(xycb,18) { B = RR(RM(z80, ea)); WM(z80, ea,B);			} /* RR   B=(XY+o)    */
OP(xycb,19) { C = RR(RM(z80, ea)); WM(z80, ea,C);			} /* RR   C=(XY+o)    */
OP(xycb,1a) { D = RR(RM(z80, ea)); WM(z80, ea,D);			} /* RR   D=(XY+o)    */
OP(xycb,1b) { E = RR(RM(z80, ea)); WM(z80, ea,E);			} /* RR   E=(XY+o)    */
OP(xycb,1c) { H = RR(RM(z80, ea)); WM(z80, ea,H);			} /* RR   H=(XY+o)    */
OP(xycb,1d) { L = RR(RM(z80, ea)); WM(z80, ea,L);			} /* RR   L=(XY+o)    */
OP(xycb,1e) { WM(z80, ea,RR(RM(z80, ea)));							} /* RR   (XY+o)      */
OP(xycb,1f) { A = RR(RM(z80, ea)); WM(z80, ea,A);			} /* RR   A=(XY+o)    */

OP(xycb,20) { B = SLA(RM(z80, ea)); WM(z80, ea,B);			} /* SLA  B=(XY+o)    */
OP(xycb,21) { C = SLA(RM(z80, ea)); WM(z80, ea,C);			} /* SLA  C=(XY+o)    */
OP(xycb,22) { D = SLA(RM(z80, ea)); WM(z80, ea,D);			} /* SLA  D=(XY+o)    */
OP(xycb,23) { E = SLA(RM(z80, ea)); WM(z80, ea,E);			} /* SLA  E=(XY+o)    */
OP(xycb,24) { H = SLA(RM(z80, ea)); WM(z80, ea,H);			} /* SLA  H=(XY+o)    */
OP(xycb,25) { L = SLA(RM(z80, ea)); WM(z80, ea,L);			} /* SLA  L=(XY+o)    */
OP(xycb,26) { WM(z80, ea,SLA(RM(z80, ea)));							} /* SLA  (XY+o)      */
OP(xycb,27) { A = SLA(RM(z80, ea)); WM(z80, ea,A);			} /* SLA  A=(XY+o)    */

OP(xycb,28) { B = SRA(RM(z80, ea)); WM(z80, ea,B);			} /* SRA  B=(XY+o)    */
OP(xycb,29) { C = SRA(RM(z80, ea)); WM(z80, ea,C);			} /* SRA  C=(XY+o)    */
OP(xycb,2a) { D = SRA(RM(z80, ea)); WM(z80, ea,D);			} /* SRA  D=(XY+o)    */
OP(xycb,2b) { E = SRA(RM(z80, ea)); WM(z80, ea,E);			} /* SRA  E=(XY+o)    */
OP(xycb,2c) { H = SRA(RM(z80, ea)); WM(z80, ea,H);			} /* SRA  H=(XY+o)    */
OP(xycb,2d) { L = SRA(RM(z80, ea)); WM(z80, ea,L);			} /* SRA  L=(XY+o)    */
OP(xycb,2e) { WM(z80, ea,SRA(RM(z80, ea)));							} /* SRA  (XY+o)      */
OP(xycb,2f) { A = SRA(RM(z80, ea)); WM(z80, ea,A);			} /* SRA  A=(XY+o)    */

OP(xycb,30) { B = SLL(RM(z80, ea)); WM(z80, ea,B);			} /* SLL  B=(XY+o)    */
OP(xycb,31) { C = SLL(RM(z80, ea)); WM(z80, ea,C);			} /* SLL  C=(XY+o)    */
OP(xycb,32) { D = SLL(RM(z80, ea)); WM(z80, ea,D);			} /* SLL  D=(XY+o)    */
OP(xycb,33) { E = SLL(RM(z80, ea)); WM(z80, ea,E);			} /* SLL  E=(XY+o)    */
OP(xycb,34) { H = SLL(RM(z80, ea)); WM(z80, ea,H);			} /* SLL  H=(XY+o)    */
OP(xycb,35) { L = SLL(RM(z80, ea)); WM(z80, ea,L);			} /* SLL  L=(XY+o)    */
OP(xycb,36) { WM(z80, ea,SLL(RM(z80, ea)));							} /* SLL  (XY+o)      */
OP(xycb,37) { A = SLL(RM(z80, ea)); WM(z80, ea,A);			} /* SLL  A=(XY+o)    */

OP(xycb,38) { B = SRL(RM(z80, ea)); WM(z80, ea,B);			} /* SRL  B=(XY+o)    */
OP(xycb,39) { C = SRL(RM(z80, ea)); WM(z80, ea,C);			} /* SRL  C=(XY+o)    */
OP(xycb,3a) { D = SRL(RM(z80, ea)); WM(z80, ea,D);			} /* SRL  D=(XY+o)    */
OP(xycb,3b) { E = SRL(RM(z80, ea)); WM(z80, ea,E);			} /* SRL  E=(XY+o)    */
OP(xycb,3c) { H = SRL(RM(z80, ea)); WM(z80, ea,H);			} /* SRL  H=(XY+o)    */
OP(xycb,3d) { L = SRL(RM(z80, ea)); WM(z80, ea,L);			} /* SRL  L=(XY+o)    */
OP(xycb,3e) { WM(z80, ea,SRL(RM(z80, ea)));							} /* SRL  (XY+o)      */
OP(xycb,3f) { A = SRL(RM(z80, ea)); WM(z80, ea,A);			} /* SRL  A=(XY+o)    */

OP(xycb,40) { xycb_46();															} /* BIT  0,(XY+o)    */
OP(xycb,41) { xycb_46();															} /* BIT  0,(XY+o)    */
OP(xycb,42) { xycb_46();															} /* BIT  0,(XY+o)    */
OP(xycb,43) { xycb_46();															} /* BIT  0,(XY+o)    */
OP(xycb,44) { xycb_46();															} /* BIT  0,(XY+o)    */
OP(xycb,45) { xycb_46();															} /* BIT  0,(XY+o)    */
OP(xycb,46) { BIT_XY(z80, 0, RM(z80, ea));										} /* BIT  0,(XY+o)    */
OP(xycb,47) { xycb_46();															} /* BIT  0,(XY+o)    */

OP(xycb,48) { xycb_4e();															} /* BIT  1,(XY+o)    */
OP(xycb,49) { xycb_4e();															} /* BIT  1,(XY+o)    */
OP(xycb,4a) { xycb_4e();															} /* BIT  1,(XY+o)    */
OP(xycb,4b) { xycb_4e();															} /* BIT  1,(XY+o)    */
OP(xycb,4c) { xycb_4e();															} /* BIT  1,(XY+o)    */
OP(xycb,4d) { xycb_4e();															} /* BIT  1,(XY+o)    */
OP(xycb,4e) { BIT_XY(z80, 1, RM(z80, ea));										} /* BIT  1,(XY+o)    */
OP(xycb,4f) { xycb_4e();															} /* BIT  1,(XY+o)    */

OP(xycb,50) { xycb_56();															} /* BIT  2,(XY+o)    */
OP(xycb,51) { xycb_56();															} /* BIT  2,(XY+o)    */
OP(xycb,52) { xycb_56();															} /* BIT  2,(XY+o)    */
OP(xycb,53) { xycb_56();															} /* BIT  2,(XY+o)    */
OP(xycb,54) { xycb_56();															} /* BIT  2,(XY+o)    */
OP(xycb,55) { xycb_56();															} /* BIT  2,(XY+o)    */
OP(xycb,56) { BIT_XY(z80, 2, RM(z80, ea));										} /* BIT  2,(XY+o)    */
OP(xycb,57) { xycb_56();															} /* BIT  2,(XY+o)    */

OP(xycb,58) { xycb_5e();															} /* BIT  3,(XY+o)    */
OP(xycb,59) { xycb_5e();															} /* BIT  3,(XY+o)    */
OP(xycb,5a) { xycb_5e();															} /* BIT  3,(XY+o)    */
OP(xycb,5b) { xycb_5e();															} /* BIT  3,(XY+o)    */
OP(xycb,5c) { xycb_5e();															} /* BIT  3,(XY+o)    */
OP(xycb,5d) { xycb_5e();															} /* BIT  3,(XY+o)    */
OP(xycb,5e) { BIT_XY(z80, 3, RM(z80, ea));										} /* BIT  3,(XY+o)    */
OP(xycb,5f) { xycb_5e();															} /* BIT  3,(XY+o)    */

OP(xycb,60) { xycb_66();															} /* BIT  4,(XY+o)    */
OP(xycb,61) { xycb_66();															} /* BIT  4,(XY+o)    */
OP(xycb,62) { xycb_66();															} /* BIT  4,(XY+o)    */
OP(xycb,63) { xycb_66();															} /* BIT  4,(XY+o)    */
OP(xycb,64) { xycb_66();															} /* BIT  4,(XY+o)    */
OP(xycb,65) { xycb_66();															} /* BIT  4,(XY+o)    */
OP(xycb,66) { BIT_XY(z80, 4, RM(z80, ea));										} /* BIT  4,(XY+o)    */
OP(xycb,67) { xycb_66();															} /* BIT  4,(XY+o)    */

OP(xycb,68) { xycb_6e();															} /* BIT  5,(XY+o)    */
OP(xycb,69) { xycb_6e();															} /* BIT  5,(XY+o)    */
OP(xycb,6a) { xycb_6e();															} /* BIT  5,(XY+o)    */
OP(xycb,6b) { xycb_6e();															} /* BIT  5,(XY+o)    */
OP(xycb,6c) { xycb_6e();															} /* BIT  5,(XY+o)    */
OP(xycb,6d) { xycb_6e();															} /* BIT  5,(XY+o)    */
OP(xycb,6e) { BIT_XY(z80, 5, RM(z80, ea));										} /* BIT  5,(XY+o)    */
OP(xycb,6f) { xycb_6e();															} /* BIT  5,(XY+o)    */

OP(xycb,70) { xycb_76();															} /* BIT  6,(XY+o)    */
OP(xycb,71) { xycb_76();															} /* BIT  6,(XY+o)    */
OP(xycb,72) { xycb_76();															} /* BIT  6,(XY+o)    */
OP(xycb,73) { xycb_76();															} /* BIT  6,(XY+o)    */
OP(xycb,74) { xycb_76();															} /* BIT  6,(XY+o)    */
OP(xycb,75) { xycb_76();															} /* BIT  6,(XY+o)    */
OP(xycb,76) { BIT_XY(z80, 6, RM(z80, ea));										} /* BIT  6,(XY+o)    */
OP(xycb,77) { xycb_76();															} /* BIT  6,(XY+o)    */

OP(xycb,78) { xycb_7e();															} /* BIT  7,(XY+o)    */
OP(xycb,79) { xycb_7e();															} /* BIT  7,(XY+o)    */
OP(xycb,7a) { xycb_7e();															} /* BIT  7,(XY+o)    */
OP(xycb,7b) { xycb_7e();															} /* BIT  7,(XY+o)    */
OP(xycb,7c) { xycb_7e();															} /* BIT  7,(XY+o)    */
OP(xycb,7d) { xycb_7e();															} /* BIT  7,(XY+o)    */
OP(xycb,7e) { BIT_XY(z80, 7, RM(z80, ea));										} /* BIT  7,(XY+o)    */
OP(xycb,7f) { xycb_7e();															} /* BIT  7,(XY+o)    */

OP(xycb,80) { B = RES(0, RM(z80, ea)); WM(z80, ea,B);			} /* RES  0,B=(XY+o)  */
OP(xycb,81) { C = RES(0, RM(z80, ea)); WM(z80, ea,C);			} /* RES  0,C=(XY+o)  */
OP(xycb,82) { D = RES(0, RM(z80, ea)); WM(z80, ea,D);			} /* RES  0,D=(XY+o)  */
OP(xycb,83) { E = RES(0, RM(z80, ea)); WM(z80, ea,E);			} /* RES  0,E=(XY+o)  */
OP(xycb,84) { H = RES(0, RM(z80, ea)); WM(z80, ea,H);			} /* RES  0,H=(XY+o)  */
OP(xycb,85) { L = RES(0, RM(z80, ea)); WM(z80, ea,L);			} /* RES  0,L=(XY+o)  */
OP(xycb,86) { WM(z80, ea, RES(0, RM(z80, ea)));							} /* RES  0,(XY+o)    */
OP(xycb,87) { A = RES(0, RM(z80, ea)); WM(z80, ea,A);			} /* RES  0,A=(XY+o)  */

OP(xycb,88) { B = RES(1, RM(z80, ea)); WM(z80, ea,B);			} /* RES  1,B=(XY+o)  */
OP(xycb,89) { C = RES(1, RM(z80, ea)); WM(z80, ea,C);			} /* RES  1,C=(XY+o)  */
OP(xycb,8a) { D = RES(1, RM(z80, ea)); WM(z80, ea,D);			} /* RES  1,D=(XY+o)  */
OP(xycb,8b) { E = RES(1, RM(z80, ea)); WM(z80, ea,E);			} /* RES  1,E=(XY+o)  */
OP(xycb,8c) { H = RES(1, RM(z80, ea)); WM(z80, ea,H);			} /* RES  1,H=(XY+o)  */
OP(xycb,8d) { L = RES(1, RM(z80, ea)); WM(z80, ea,L);			} /* RES  1,L=(XY+o)  */
OP(xycb,8e) { WM(z80, ea, RES(1, RM(z80, ea)));							} /* RES  1,(XY+o)    */
OP(xycb,8f) { A = RES(1, RM(z80, ea)); WM(z80, ea,A);			} /* RES  1,A=(XY+o)  */

OP(xycb,90) { B = RES(2, RM(z80, ea)); WM(z80, ea,B);			} /* RES  2,B=(XY+o)  */
OP(xycb,91) { C = RES(2, RM(z80, ea)); WM(z80, ea,C);			} /* RES  2,C=(XY+o)  */
OP(xycb,92) { D = RES(2, RM(z80, ea)); WM(z80, ea,D);			} /* RES  2,D=(XY+o)  */
OP(xycb,93) { E = RES(2, RM(z80, ea)); WM(z80, ea,E);			} /* RES  2,E=(XY+o)  */
OP(xycb,94) { H = RES(2, RM(z80, ea)); WM(z80, ea,H);			} /* RES  2,H=(XY+o)  */
OP(xycb,95) { L = RES(2, RM(z80, ea)); WM(z80, ea,L);			} /* RES  2,L=(XY+o)  */
OP(xycb,96) { WM(z80, ea, RES(2, RM(z80, ea)));							} /* RES  2,(XY+o)    */
OP(xycb,97) { A = RES(2, RM(z80, ea)); WM(z80, ea,A);			} /* RES  2,A=(XY+o)  */

OP(xycb,98) { B = RES(3, RM(z80, ea)); WM(z80, ea,B);			} /* RES  3,B=(XY+o)  */
OP(xycb,99) { C = RES(3, RM(z80, ea)); WM(z80, ea,C);			} /* RES  3,C=(XY+o)  */
OP(xycb,9a) { D = RES(3, RM(z80, ea)); WM(z80, ea,D);			} /* RES  3,D=(XY+o)  */
OP(xycb,9b) { E = RES(3, RM(z80, ea)); WM(z80, ea,E);			} /* RES  3,E=(XY+o)  */
OP(xycb,9c) { H = RES(3, RM(z80, ea)); WM(z80, ea,H);			} /* RES  3,H=(XY+o)  */
OP(xycb,9d) { L = RES(3, RM(z80, ea)); WM(z80, ea,L);			} /* RES  3,L=(XY+o)  */
OP(xycb,9e) { WM(z80, ea, RES(3, RM(z80, ea)));							} /* RES  3,(XY+o)    */
OP(xycb,9f) { A = RES(3, RM(z80, ea)); WM(z80, ea,A);			} /* RES  3,A=(XY+o)  */

OP(xycb,a0) { B = RES(4, RM(z80, ea)); WM(z80, ea,B);			} /* RES  4,B=(XY+o)  */
OP(xycb,a1) { C = RES(4, RM(z80, ea)); WM(z80, ea,C);			} /* RES  4,C=(XY+o)  */
OP(xycb,a2) { D = RES(4, RM(z80, ea)); WM(z80, ea,D);			} /* RES  4,D=(XY+o)  */
OP(xycb,a3) { E = RES(4, RM(z80, ea)); WM(z80, ea,E);			} /* RES  4,E=(XY+o)  */
OP(xycb,a4) { H = RES(4, RM(z80, ea)); WM(z80, ea,H);			} /* RES  4,H=(XY+o)  */
OP(xycb,a5) { L = RES(4, RM(z80, ea)); WM(z80, ea,L);			} /* RES  4,L=(XY+o)  */
OP(xycb,a6) { WM(z80, ea, RES(4, RM(z80, ea)));							} /* RES  4,(XY+o)    */
OP(xycb,a7) { A = RES(4, RM(z80, ea)); WM(z80, ea,A);			} /* RES  4,A=(XY+o)  */

OP(xycb,a8) { B = RES(5, RM(z80, ea)); WM(z80, ea,B);			} /* RES  5,B=(XY+o)  */
OP(xycb,a9) { C = RES(5, RM(z80, ea)); WM(z80, ea,C);			} /* RES  5,C=(XY+o)  */
OP(xycb,aa) { D = RES(5, RM(z80, ea)); WM(z80, ea,D);			} /* RES  5,D=(XY+o)  */
OP(xycb,ab) { E = RES(5, RM(z80, ea)); WM(z80, ea,E);			} /* RES  5,E=(XY+o)  */
OP(xycb,ac) { H = RES(5, RM(z80, ea)); WM(z80, ea,H);			} /* RES  5,H=(XY+o)  */
OP(xycb,ad) { L = RES(5, RM(z80, ea)); WM(z80, ea,L);			} /* RES  5,L=(XY+o)  */
OP(xycb,ae) { WM(z80, ea, RES(5, RM(z80, ea)));							} /* RES  5,(XY+o)    */
OP(xycb,af) { A = RES(5, RM(z80, ea)); WM(z80, ea,A);			} /* RES  5,A=(XY+o)  */

OP(xycb,b0) { B = RES(6, RM(z80, ea)); WM(z80, ea,B);			} /* RES  6,B=(XY+o)  */
OP(xycb,b1) { C = RES(6, RM(z80, ea)); WM(z80, ea,C);			} /* RES  6,C=(XY+o)  */
OP(xycb,b2) { D = RES(6, RM(z80, ea)); WM(z80, ea,D);			} /* RES  6,D=(XY+o)  */
OP(xycb,b3) { E = RES(6, RM(z80, ea)); WM(z80, ea,E);			} /* RES  6,E=(XY+o)  */
OP(xycb,b4) { H = RES(6, RM(z80, ea)); WM(z80, ea,H);			} /* RES  6,H=(XY+o)  */
OP(xycb,b5) { L = RES(6, RM(z80, ea)); WM(z80, ea,L);			} /* RES  6,L=(XY+o)  */
OP(xycb,b6) { WM(z80, ea, RES(6, RM(z80, ea)));							} /* RES  6,(XY+o)    */
OP(xycb,b7) { A = RES(6, RM(z80, ea)); WM(z80, ea,A);			} /* RES  6,A=(XY+o)  */

OP(xycb,b8) { B = RES(7, RM(z80, ea)); WM(z80, ea,B);			} /* RES  7,B=(XY+o)  */
OP(xycb,b9) { C = RES(7, RM(z80, ea)); WM(z80, ea,C);			} /* RES  7,C=(XY+o)  */
OP(xycb,ba) { D = RES(7, RM(z80, ea)); WM(z80, ea,D);			} /* RES  7,D=(XY+o)  */
OP(xycb,bb) { E = RES(7, RM(z80, ea)); WM(z80, ea,E);			} /* RES  7,E=(XY+o)  */
OP(xycb,bc) { H = RES(7, RM(z80, ea)); WM(z80, ea,H);			} /* RES  7,H=(XY+o)  */
OP(xycb,bd) { L = RES(7, RM(z80, ea)); WM(z80, ea,L);			} /* RES  7,L=(XY+o)  */
OP(xycb,be) { WM(z80, ea, RES(7, RM(z80, ea)));							} /* RES  7,(XY+o)    */
OP(xycb,bf) { A = RES(7, RM(z80, ea)); WM(z80, ea,A);			} /* RES  7,A=(XY+o)  */

OP(xycb,c0) { B = SET(0, RM(z80, ea)); WM(z80, ea,B);			} /* SET  0,B=(XY+o)  */
OP(xycb,c1) { C = SET(0, RM(z80, ea)); WM(z80, ea,C);			} /* SET  0,C=(XY+o)  */
OP(xycb,c2) { D = SET(0, RM(z80, ea)); WM(z80, ea,D);			} /* SET  0,D=(XY+o)  */
OP(xycb,c3) { E = SET(0, RM(z80, ea)); WM(z80, ea,E);			} /* SET  0,E=(XY+o)  */
OP(xycb,c4) { H = SET(0, RM(z80, ea)); WM(z80, ea,H);			} /* SET  0,H=(XY+o)  */
OP(xycb,c5) { L = SET(0, RM(z80, ea)); WM(z80, ea,L);			} /* SET  0,L=(XY+o)  */
OP(xycb,c6) { WM(z80, ea, SET(0, RM(z80, ea)));							} /* SET  0,(XY+o)    */
OP(xycb,c7) { A = SET(0, RM(z80, ea)); WM(z80, ea,A);			} /* SET  0,A=(XY+o)  */

OP(xycb,c8) { B = SET(1, RM(z80, ea)); WM(z80, ea,B);			} /* SET  1,B=(XY+o)  */
OP(xycb,c9) { C = SET(1, RM(z80, ea)); WM(z80, ea,C);			} /* SET  1,C=(XY+o)  */
OP(xycb,ca) { D = SET(1, RM(z80, ea)); WM(z80, ea,D);			} /* SET  1,D=(XY+o)  */
OP(xycb,cb) { E = SET(1, RM(z80, ea)); WM(z80, ea,E);			} /* SET  1,E=(XY+o)  */
OP(xycb,cc) { H = SET(1, RM(z80, ea)); WM(z80, ea,H);			} /* SET  1,H=(XY+o)  */
OP(xycb,cd) { L = SET(1, RM(z80, ea)); WM(z80, ea,L);			} /* SET  1,L=(XY+o)  */
OP(xycb,ce) { WM(z80, ea, SET(1, RM(z80, ea)));							} /* SET  1,(XY+o)    */
OP(xycb,cf) { A = SET(1, RM(z80, ea)); WM(z80, ea,A);			} /* SET  1,A=(XY+o)  */

OP(xycb,d0) { B = SET(2, RM(z80, ea)); WM(z80, ea,B);			} /* SET  2,B=(XY+o)  */
OP(xycb,d1) { C = SET(2, RM(z80, ea)); WM(z80, ea,C);			} /* SET  2,C=(XY+o)  */
OP(xycb,d2) { D = SET(2, RM(z80, ea)); WM(z80, ea,D);			} /* SET  2,D=(XY+o)  */
OP(xycb,d3) { E = SET(2, RM(z80, ea)); WM(z80, ea,E);			} /* SET  2,E=(XY+o)  */
OP(xycb,d4) { H = SET(2, RM(z80, ea)); WM(z80, ea,H);			} /* SET  2,H=(XY+o)  */
OP(xycb,d5) { L = SET(2, RM(z80, ea)); WM(z80, ea,L);			} /* SET  2,L=(XY+o)  */
OP(xycb,d6) { WM(z80, ea, SET(2, RM(z80, ea)));							} /* SET  2,(XY+o)    */
OP(xycb,d7) { A = SET(2, RM(z80, ea)); WM(z80, ea,A);			} /* SET  2,A=(XY+o)  */

OP(xycb,d8) { B = SET(3, RM(z80, ea)); WM(z80, ea,B);			} /* SET  3,B=(XY+o)  */
OP(xycb,d9) { C = SET(3, RM(z80, ea)); WM(z80, ea,C);			} /* SET  3,C=(XY+o)  */
OP(xycb,da) { D = SET(3, RM(z80, ea)); WM(z80, ea,D);			} /* SET  3,D=(XY+o)  */
OP(xycb,db) { E = SET(3, RM(z80, ea)); WM(z80, ea,E);			} /* SET  3,E=(XY+o)  */
OP(xycb,dc) { H = SET(3, RM(z80, ea)); WM(z80, ea,H);			} /* SET  3,H=(XY+o)  */
OP(xycb,dd) { L = SET(3, RM(z80, ea)); WM(z80, ea,L);			} /* SET  3,L=(XY+o)  */
OP(xycb,de) { WM(z80, ea, SET(3, RM(z80, ea)));							} /* SET  3,(XY+o)    */
OP(xycb,df) { A = SET(3, RM(z80, ea)); WM(z80, ea,A);			} /* SET  3,A=(XY+o)  */

OP(xycb,e0) { B = SET(4, RM(z80, ea)); WM(z80, ea,B);			} /* SET  4,B=(XY+o)  */
OP(xycb,e1) { C = SET(4, RM(z80, ea)); WM(z80, ea,C);			} /* SET  4,C=(XY+o)  */
OP(xycb,e2) { D = SET(4, RM(z80, ea)); WM(z80, ea,D);			} /* SET  4,D=(XY+o)  */
OP(xycb,e3) { E = SET(4, RM(z80, ea)); WM(z80, ea,E);			} /* SET  4,E=(XY+o)  */
OP(xycb,e4) { H = SET(4, RM(z80, ea)); WM(z80, ea,H);			} /* SET  4,H=(XY+o)  */
OP(xycb,e5) { L = SET(4, RM(z80, ea)); WM(z80, ea,L);			} /* SET  4,L=(XY+o)  */
OP(xycb,e6) { WM(z80, ea, SET(4, RM(z80, ea)));							} /* SET  4,(XY+o)    */
OP(xycb,e7) { A = SET(4, RM(z80, ea)); WM(z80, ea,A);			} /* SET  4,A=(XY+o)  */

OP(xycb,e8) { B = SET(5, RM(z80, ea)); WM(z80, ea,B);			} /* SET  5,B=(XY+o)  */
OP(xycb,e9) { C = SET(5, RM(z80, ea)); WM(z80, ea,C);			} /* SET  5,C=(XY+o)  */
OP(xycb,ea) { D = SET(5, RM(z80, ea)); WM(z80, ea,D);			} /* SET  5,D=(XY+o)  */
OP(xycb,eb) { E = SET(5, RM(z80, ea)); WM(z80, ea,E);			} /* SET  5,E=(XY+o)  */
OP(xycb,ec) { H = SET(5, RM(z80, ea)); WM(z80, ea,H);			} /* SET  5,H=(XY+o)  */
OP(xycb,ed) { L = SET(5, RM(z80, ea)); WM(z80, ea,L);			} /* SET  5,L=(XY+o)  */
OP(xycb,ee) { WM(z80, ea, SET(5, RM(z80, ea)));							} /* SET  5,(XY+o)    */
OP(xycb,ef) { A = SET(5, RM(z80, ea)); WM(z80, ea,A);			} /* SET  5,A=(XY+o)  */

OP(xycb,f0) { B = SET(6, RM(z80, ea)); WM(z80, ea,B);			} /* SET  6,B=(XY+o)  */
OP(xycb,f1) { C = SET(6, RM(z80, ea)); WM(z80, ea,C);			} /* SET  6,C=(XY+o)  */
OP(xycb,f2) { D = SET(6, RM(z80, ea)); WM(z80, ea,D);			} /* SET  6,D=(XY+o)  */
OP(xycb,f3) { E = SET(6, RM(z80, ea)); WM(z80, ea,E);			} /* SET  6,E=(XY+o)  */
OP(xycb,f4) { H = SET(6, RM(z80, ea)); WM(z80, ea,H);			} /* SET  6,H=(XY+o)  */
OP(xycb,f5) { L = SET(6, RM(z80, ea)); WM(z80, ea,L);			} /* SET  6,L=(XY+o)  */
OP(xycb,f6) { WM(z80, ea, SET(6, RM(z80, ea)));							} /* SET  6,(XY+o)    */
OP(xycb,f7) { A = SET(6, RM(z80, ea)); WM(z80, ea,A);			} /* SET  6,A=(XY+o)  */

OP(xycb,f8) { B = SET(7, RM(z80, ea)); WM(z80, ea,B);			} /* SET  7,B=(XY+o)  */
OP(xycb,f9) { C = SET(7, RM(z80, ea)); WM(z80, ea,C);			} /* SET  7,C=(XY+o)  */
OP(xycb,fa) { D = SET(7, RM(z80, ea)); WM(z80, ea,D);			} /* SET  7,D=(XY+o)  */
OP(xycb,fb) { E = SET(7, RM(z80, ea)); WM(z80, ea,E);			} /* SET  7,E=(XY+o)  */
OP(xycb,fc) { H = SET(7, RM(z80, ea)); WM(z80, ea,H);			} /* SET  7,H=(XY+o)  */
OP(xycb,fd) { L = SET(7, RM(z80, ea)); WM(z80, ea,L);			} /* SET  7,L=(XY+o)  */
OP(xycb,fe) { WM(z80, ea, SET(7, RM(z80, ea)));							} /* SET  7,(XY+o)    */
OP(xycb,ff) { A = SET(7, RM(z80, ea)); WM(z80, ea,A);			} /* SET  7,A=(XY+o)  */

OP(cb,00) { B = RLC(B);												} /* RLC  B           */
OP(cb,01) { C = RLC(C);												} /* RLC  C           */
OP(cb,02) { D = RLC(D);												} /* RLC  D           */
OP(cb,03) { E = RLC(E);												} /* RLC  E           */
OP(cb,04) { H = RLC(H);												} /* RLC  H           */
OP(cb,05) { L = RLC(L);												} /* RLC  L           */
OP(cb,06) { WM(z80, HL, RLC(RM(z80, HL)));							} /* RLC  (HL)        */
OP(cb,07) { A = RLC(A);												} /* RLC  A           */

OP(cb,08) { B = RRC(B);												} /* RRC  B           */
OP(cb,09) { C = RRC(C);												} /* RRC  C           */
OP(cb,0a) { D = RRC(D);												} /* RRC  D           */
OP(cb,0b) { E = RRC(E);												} /* RRC  E           */
OP(cb,0c) { H = RRC(H);												} /* RRC  H           */
OP(cb,0d) { L = RRC(L);												} /* RRC  L           */
OP(cb,0e) { WM(z80, HL, RRC(RM(z80, HL)));							} /* RRC  (HL)        */
OP(cb,0f) { A = RRC(A);												} /* RRC  A           */

OP(cb,10) { B = RL(B);												} /* RL   B           */
OP(cb,11) { C = RL(C);												} /* RL   C           */
OP(cb,12) { D = RL(D);												} /* RL   D           */
OP(cb,13) { E = RL(E);												} /* RL   E           */
OP(cb,14) { H = RL(H);												} /* RL   H           */
OP(cb,15) { L = RL(L);												} /* RL   L           */
OP(cb,16) { WM(z80, HL, RL(RM(z80, HL)));							} /* RL   (HL)        */
OP(cb,17) { A = RL(A);												} /* RL   A           */

OP(cb,18) { B = RR(B);												} /* RR   B           */
OP(cb,19) { C = RR(C);												} /* RR   C           */
OP(cb,1a) { D = RR(D);												} /* RR   D           */
OP(cb,1b) { E = RR(E);												} /* RR   E           */
OP(cb,1c) { H = RR(H);												} /* RR   H           */
OP(cb,1d) { L = RR(L);												} /* RR   L           */
OP(cb,1e) { WM(z80, HL, RR(RM(z80, HL)));							} /* RR   (HL)        */
OP(cb,1f) { A = RR(A);												} /* RR   A           */

OP(cb,20) { B = SLA(B);												} /* SLA  B           */
OP(cb,21) { C = SLA(C);												} /* SLA  C           */
OP(cb,22) { D = SLA(D);												} /* SLA  D           */
OP(cb,23) { E = SLA(E);												} /* SLA  E           */
OP(cb,24) { H = SLA(H);												} /* SLA  H           */
OP(cb,25) { L = SLA(L);												} /* SLA  L           */
OP(cb,26) { WM(z80, HL, SLA(RM(z80, HL)));							} /* SLA  (HL)        */
OP(cb,27) { A = SLA(A);												} /* SLA  A           */

OP(cb,28) { B = SRA(B);												} /* SRA  B           */
OP(cb,29) { C = SRA(C);												} /* SRA  C           */
OP(cb,2a) { D = SRA(D);												} /* SRA  D           */
OP(cb,2b) { E = SRA(E);												} /* SRA  E           */
OP(cb,2c) { H = SRA(H);												} /* SRA  H           */
OP(cb,2d) { L = SRA(L);												} /* SRA  L           */
OP(cb,2e) { WM(z80, HL, SRA(RM(z80, HL)));							} /* SRA  (HL)        */
OP(cb,2f) { A = SRA(A);												} /* SRA  A           */

OP(cb,30) { B = SLL(B);												} /* SLL  B           */
OP(cb,31) { C = SLL(C);												} /* SLL  C           */
OP(cb,32) { D = SLL(D);												} /* SLL  D           */
OP(cb,33) { E = SLL(E);												} /* SLL  E           */
OP(cb,34) { H = SLL(H);												} /* SLL  H           */
OP(cb,35) { L = SLL(L);												} /* SLL  L           */
OP(cb,36) { WM(z80, HL, SLL(RM(z80, HL)));							} /* SLL  (HL)        */
OP(cb,37) { A = SLL(A);												} /* SLL  A           */

OP(cb,38) { B = SRL(B);												} /* SRL  B           */
OP(cb,39) { C = SRL(C);												} /* SRL  C           */
OP(cb,3a) { D = SRL(D);												} /* SRL  D           */
OP(cb,3b) { E = SRL(E);												} /* SRL  E           */
OP(cb,3c) { H = SRL(H);												} /* SRL  H           */
OP(cb,3d) { L = SRL(L);												} /* SRL  L           */
OP(cb,3e) { WM(z80, HL, SRL(RM(z80, HL)));							} /* SRL  (HL)        */
OP(cb,3f) { A = SRL(A);												} /* SRL  A           */

OP(cb,40) { BIT(z80, 0, B);													} /* BIT  0,B         */
OP(cb,41) { BIT(z80, 0, C);													} /* BIT  0,C         */
OP(cb,42) { BIT(z80, 0, D);													} /* BIT  0,D         */
OP(cb,43) { BIT(z80, 0, E);													} /* BIT  0,E         */
OP(cb,44) { BIT(z80, 0, H);													} /* BIT  0,H         */
OP(cb,45) { BIT(z80, 0, L);													} /* BIT  0,L         */
OP(cb,46) { BIT_HL(z80, 0, RM(z80, HL));										} /* BIT  0,(HL)      */
OP(cb,47) { BIT(z80, 0, A);													} /* BIT  0,A         */

OP(cb,48) { BIT(z80, 1, B);													} /* BIT  1,B         */
OP(cb,49) { BIT(z80, 1, C);													} /* BIT  1,C         */
OP(cb,4a) { BIT(z80, 1, D);													} /* BIT  1,D         */
OP(cb,4b) { BIT(z80, 1, E);													} /* BIT  1,E         */
OP(cb,4c) { BIT(z80, 1, H);													} /* BIT  1,H         */
OP(cb,4d) { BIT(z80, 1, L);													} /* BIT  1,L         */
OP(cb,4e) { BIT_HL(z80, 1, RM(z80, HL));										} /* BIT  1,(HL)      */
OP(cb,4f) { BIT(z80, 1, A);													} /* BIT  1,A         */

OP(cb,50) { BIT(z80, 2, B);													} /* BIT  2,B         */
OP(cb,51) { BIT(z80, 2, C);													} /* BIT  2,C         */
OP(cb,52) { BIT(z80, 2, D);													} /* BIT  2,D         */
OP(cb,53) { BIT(z80, 2, E);													} /* BIT  2,E         */
OP(cb,54) { BIT(z80, 2, H);													} /* BIT  2,H         */
OP(cb,55) { BIT(z80, 2, L);													} /* BIT  2,L         */
OP(cb,56) { BIT_HL(z80, 2, RM(z80, HL));										} /* BIT  2,(HL)      */
OP(cb,57) { BIT(z80, 2, A);													} /* BIT  2,A         */

OP(cb,58) { BIT(z80, 3, B);													} /* BIT  3,B         */
OP(cb,59) { BIT(z80, 3, C);													} /* BIT  3,C         */
OP(cb,5a) { BIT(z80, 3, D);													} /* BIT  3,D         */
OP(cb,5b) { BIT(z80, 3, E);													} /* BIT  3,E         */
OP(cb,5c) { BIT(z80, 3, H);													} /* BIT  3,H         */
OP(cb,5d) { BIT(z80, 3, L);													} /* BIT  3,L         */
OP(cb,5e) { BIT_HL(z80, 3, RM(z80, HL));										} /* BIT  3,(HL)      */
OP(cb,5f) { BIT(z80, 3, A);													} /* BIT  3,A         */

OP(cb,60) { BIT(z80, 4, B);													} /* BIT  4,B         */
OP(cb,61) { BIT(z80, 4, C);													} /* BIT  4,C         */
OP(cb,62) { BIT(z80, 4, D);													} /* BIT  4,D         */
OP(cb,63) { BIT(z80, 4, E);													} /* BIT  4,E         */
OP(cb,64) { BIT(z80, 4, H);													} /* BIT  4,H         */
OP(cb,65) { BIT(z80, 4, L);													} /* BIT  4,L         */
OP(cb,66) { BIT_HL(z80, 4, RM(z80, HL));										} /* BIT  4,(HL)      */
OP(cb,67) { BIT(z80, 4, A);													} /* BIT  4,A         */

OP(cb,68) { BIT(z80, 5, B);													} /* BIT  5,B         */
OP(cb,69) { BIT(z80, 5, C);													} /* BIT  5,C         */
OP(cb,6a) { BIT(z80, 5, D);													} /* BIT  5,D         */
OP(cb,6b) { BIT(z80, 5, E);													} /* BIT  5,E         */
OP(cb,6c) { BIT(z80, 5, H);													} /* BIT  5,H         */
OP(cb,6d) { BIT(z80, 5, L);													} /* BIT  5,L         */
OP(cb,6e) { BIT_HL(z80, 5, RM(z80, HL));										} /* BIT  5,(HL)      */
OP(cb,6f) { BIT(z80, 5, A);													} /* BIT  5,A         */

OP(cb,70) { BIT(z80, 6, B);													} /* BIT  6,B         */
OP(cb,71) { BIT(z80, 6, C);													} /* BIT  6,C         */
OP(cb,72) { BIT(z80, 6, D);													} /* BIT  6,D         */
OP(cb,73) { BIT(z80, 6, E);													} /* BIT  6,E         */
OP(cb,74) { BIT(z80, 6, H);													} /* BIT  6,H         */
OP(cb,75) { BIT(z80, 6, L);													} /* BIT  6,L         */
OP(cb,76) { BIT_HL(z80, 6, RM(z80, HL));										} /* BIT  6,(HL)      */
OP(cb,77) { BIT(z80, 6, A);													} /* BIT  6,A         */

OP(cb,78) { BIT(z80, 7, B);													} /* BIT  7,B         */
OP(cb,79) { BIT(z80, 7, C);													} /* BIT  7,C         */
OP(cb,7a) { BIT(z80, 7, D);													} /* BIT  7,D         */
OP(cb,7b) { BIT(z80, 7, E);													} /* BIT  7,E         */
OP(cb,7c) { BIT(z80, 7, H);													} /* BIT  7,H         */
OP(cb,7d) { BIT(z80, 7, L);													} /* BIT  7,L         */
OP(cb,7e) { BIT_HL(z80, 7, RM(z80, HL));										} /* BIT  7,(HL)      */
OP(cb,7f) { BIT(z80, 7, A);													} /* BIT  7,A         */

OP(cb,80) { B = RES(0, B);												} /* RES  0,B         */
OP(cb,81) { C = RES(0, C);												} /* RES  0,C         */
OP(cb,82) { D = RES(0, D);												} /* RES  0,D         */
OP(cb,83) { E = RES(0, E);												} /* RES  0,E         */
OP(cb,84) { H = RES(0, H);												} /* RES  0,H         */
OP(cb,85) { L = RES(0, L);												} /* RES  0,L         */
OP(cb,86) { WM(z80, HL, RES(0, RM(z80, HL)));								} /* RES  0,(HL)      */
OP(cb,87) { A = RES(0, A);												} /* RES  0,A         */

OP(cb,88) { B = RES(1, B);												} /* RES  1,B         */
OP(cb,89) { C = RES(1, C);												} /* RES  1,C         */
OP(cb,8a) { D = RES(1, D);												} /* RES  1,D         */
OP(cb,8b) { E = RES(1, E);												} /* RES  1,E         */
OP(cb,8c) { H = RES(1, H);												} /* RES  1,H         */
OP(cb,8d) { L = RES(1, L);												} /* RES  1,L         */
OP(cb,8e) { WM(z80, HL, RES(1, RM(z80, HL)));								} /* RES  1,(HL)      */
OP(cb,8f) { A = RES(1, A);												} /* RES  1,A         */

OP(cb,90) { B = RES(2, B);												} /* RES  2,B         */
OP(cb,91) { C = RES(2, C);												} /* RES  2,C         */
OP(cb,92) { D = RES(2, D);												} /* RES  2,D         */
OP(cb,93) { E = RES(2, E);												} /* RES  2,E         */
OP(cb,94) { H = RES(2, H);												} /* RES  2,H         */
OP(cb,95) { L = RES(2, L);												} /* RES  2,L         */
OP(cb,96) { WM(z80, HL, RES(2, RM(z80, HL)));								} /* RES  2,(HL)      */
OP(cb,97) { A = RES(2, A);												} /* RES  2,A         */

OP(cb,98) { B = RES(3, B);												} /* RES  3,B         */
OP(cb,99) { C = RES(3, C);												} /* RES  3,C         */
OP(cb,9a) { D = RES(3, D);												} /* RES  3,D         */
OP(cb,9b) { E = RES(3, E);												} /* RES  3,E         */
OP(cb,9c) { H = RES(3, H);												} /* RES  3,H         */
OP(cb,9d) { L = RES(3, L);												} /* RES  3,L         */
OP(cb,9e) { WM(z80, HL, RES(3, RM(z80, HL)));								} /* RES  3,(HL)      */
OP(cb,9f) { A = RES(3, A);												} /* RES  3,A         */

OP(cb,a0) { B = RES(4,	B);												} /* RES  4,B         */
OP(cb,a1) { C = RES(4,	C);												} /* RES  4,C         */
OP(cb,a2) { D = RES(4,	D);												} /* RES  4,D         */
OP(cb,a3) { E = RES(4,	E);												} /* RES  4,E         */
OP(cb,a4) { H = RES(4,	H);												} /* RES  4,H         */
OP(cb,a5) { L = RES(4,	L);												} /* RES  4,L         */
OP(cb,a6) { WM(z80, HL, RES(4,	RM(z80, HL)));								} /* RES  4,(HL)      */
OP(cb,a7) { A = RES(4,	A);												} /* RES  4,A         */

OP(cb,a8) { B = RES(5, B);												} /* RES  5,B         */
OP(cb,a9) { C = RES(5, C);												} /* RES  5,C         */
OP(cb,aa) { D = RES(5, D);												} /* RES  5,D         */
OP(cb,ab) { E = RES(5, E);												} /* RES  5,E         */
OP(cb,ac) { H = RES(5, H);												} /* RES  5,H         */
OP(cb,ad) { L = RES(5, L);												} /* RES  5,L         */
OP(cb,ae) { WM(z80, HL, RES(5, RM(z80, HL)));								} /* RES  5,(HL)      */
OP(cb,af) { A = RES(5, A);												} /* RES  5,A         */

OP(cb,b0) { B = RES(6, B);												} /* RES  6,B         */
OP(cb,b1) { C = RES(6, C);												} /* RES  6,C         */
OP(cb,b2) { D = RES(6, D);												} /* RES  6,D         */
OP(cb,b3) { E = RES(6, E);												} /* RES  6,E         */
OP(cb,b4) { H = RES(6, H);												} /* RES  6,H         */
OP(cb,b5) { L = RES(6, L);												} /* RES  6,L         */
OP(cb,b6) { WM(z80, HL, RES(6, RM(z80, HL)));								} /* RES  6,(HL)      */
OP(cb,b7) { A = RES(6, A);												} /* RES  6,A         */

OP(cb,b8) { B = RES(7, B);												} /* RES  7,B         */
OP(cb,b9) { C = RES(7, C);												} /* RES  7,C         */
OP(cb,ba) { D = RES(7, D);												} /* RES  7,D         */
OP(cb,bb) { E = RES(7, E);												} /* RES  7,E         */
OP(cb,bc) { H = RES(7, H);												} /* RES  7,H         */
OP(cb,bd) { L = RES(7, L);												} /* RES  7,L         */
OP(cb,be) { WM(z80, HL, RES(7, RM(z80, HL)));								} /* RES  7,(HL)      */
OP(cb,bf) { A = RES(7, A);												} /* RES  7,A         */

OP(cb,c0) { B = SET(0, B);												} /* SET  0,B         */
OP(cb,c1) { C = SET(0, C);												} /* SET  0,C         */
OP(cb,c2) { D = SET(0, D);												} /* SET  0,D         */
OP(cb,c3) { E = SET(0, E);												} /* SET  0,E         */
OP(cb,c4) { H = SET(0, H);												} /* SET  0,H         */
OP(cb,c5) { L = SET(0, L);												} /* SET  0,L         */
OP(cb,c6) { WM(z80, HL, SET(0, RM(z80, HL)));								} /* SET  0,(HL)      */
OP(cb,c7) { A = SET(0, A);												} /* SET  0,A         */

OP(cb,c8) { B = SET(1, B);												} /* SET  1,B         */
OP(cb,c9) { C = SET(1, C);												} /* SET  1,C         */
OP(cb,ca) { D = SET(1, D);												} /* SET  1,D         */
OP(cb,cb) { E = SET(1, E);												} /* SET  1,E         */
OP(cb,cc) { H = SET(1, H);												} /* SET  1,H         */
OP(cb,cd) { L = SET(1, L);												} /* SET  1,L         */
OP(cb,ce) { WM(z80, HL, SET(1, RM(z80, HL)));								} /* SET  1,(HL)      */
OP(cb,cf) { A = SET(1, A);												} /* SET  1,A         */

OP(cb,d0) { B = SET(2, B);												} /* SET  2,B         */
OP(cb,d1) { C = SET(2, C);												} /* SET  2,C         */
OP(cb,d2) { D = SET(2, D);												} /* SET  2,D         */
OP(cb,d3) { E = SET(2, E);												} /* SET  2,E         */
OP(cb,d4) { H = SET(2, H);												} /* SET  2,H         */
OP(cb,d5) { L = SET(2, L);												} /* SET  2,L         */
OP(cb,d6) { WM(z80, HL, SET(2, RM(z80, HL)));								} /* SET  2,(HL)      */
OP(cb,d7) { A = SET(2, A);												} /* SET  2,A         */

OP(cb,d8) { B = SET(3, B);												} /* SET  3,B         */
OP(cb,d9) { C = SET(3, C);												} /* SET  3,C         */
OP(cb,da) { D = SET(3, D);												} /* SET  3,D         */
OP(cb,db) { E = SET(3, E);												} /* SET  3,E         */
OP(cb,dc) { H = SET(3, H);												} /* SET  3,H         */
OP(cb,dd) { L = SET(3, L);												} /* SET  3,L         */
OP(cb,de) { WM(z80, HL, SET(3, RM(z80, HL)));								} /* SET  3,(HL)      */
OP(cb,df) { A = SET(3, A);												} /* SET  3,A         */

OP(cb,e0) { B = SET(4, B);												} /* SET  4,B         */
OP(cb,e1) { C = SET(4, C);												} /* SET  4,C         */
OP(cb,e2) { D = SET(4, D);												} /* SET  4,D         */
OP(cb,e3) { E = SET(4, E);												} /* SET  4,E         */
OP(cb,e4) { H = SET(4, H);												} /* SET  4,H         */
OP(cb,e5) { L = SET(4, L);												} /* SET  4,L         */
OP(cb,e6) { WM(z80, HL, SET(4, RM(z80, HL)));								} /* SET  4,(HL)      */
OP(cb,e7) { A = SET(4, A);												} /* SET  4,A         */

OP(cb,e8) { B = SET(5, B);												} /* SET  5,B         */
OP(cb,e9) { C = SET(5, C);												} /* SET  5,C         */
OP(cb,ea) { D = SET(5, D);												} /* SET  5,D         */
OP(cb,eb) { E = SET(5, E);												} /* SET  5,E         */
OP(cb,ec) { H = SET(5, H);												} /* SET  5,H         */
OP(cb,ed) { L = SET(5, L);												} /* SET  5,L         */
OP(cb,ee) { WM(z80, HL, SET(5, RM(z80, HL)));								} /* SET  5,(HL)      */
OP(cb,ef) { A = SET(5, A);												} /* SET  5,A         */

OP(cb,f0) { B = SET(6, B);												} /* SET  6,B         */
OP(cb,f1) { C = SET(6, C);												} /* SET  6,C         */
OP(cb,f2) { D = SET(6, D);												} /* SET  6,D         */
OP(cb,f3) { E = SET(6, E);												} /* SET  6,E         */
OP(cb,f4) { H = SET(6, H);												} /* SET  6,H         */
OP(cb,f5) { L = SET(6, L);												} /* SET  6,L         */
OP(cb,f6) { WM(z80, HL, SET(6, RM(z80, HL)));								} /* SET  6,(HL)      */
OP(cb,f7) { A = SET(6, A);												} /* SET  6,A         */

OP(cb,f8) { B = SET(7, B);												} /* SET  7,B         */
OP(cb,f9) { C = SET(7, C);												} /* SET  7,C         */
OP(cb,fa) { D = SET(7, D);												} /* SET  7,D         */
OP(cb,fb) { E = SET(7, E);												} /* SET  7,E         */
OP(cb,fc) { H = SET(7, H);												} /* SET  7,H         */
OP(cb,fd) { L = SET(7, L);												} /* SET  7,L         */
OP(cb,fe) { WM(z80, HL, SET(7, RM(z80, HL)));								} /* SET  7,(HL)      */
OP(cb,ff) { A = SET(7, A);												} /* SET  7,A         */


/**********************************************************
 * main opcodes
 **********************************************************/
OP(op,00) {																			} /* NOP              */
OP(op,01) { BC = ARG16();													} /* LD   BC,w        */
OP(op,02) { WM(z,BC,A); MEMPTR_L = (BC + 1) & 0xFF;  MEMPTR_H = A; } /* LD   (BC),A      */
OP(op,03) { BC++;																} /* INC  BC          */
OP(op,04) { B = INC(B);												} /* INC  B           */
OP(op,05) { B = DEC(B);												} /* DEC  B           */
OP(op,06) { B = ARG();														} /* LD   B,n         */
OP(op,07) { RLCA(z80);																} /* RLCA             */

OP(op,08) { EX_AF(z80);																} /* EX   AF,AF'      */
OP(op,09) { ADD16(z80, hl, bc);														} /* ADD  HL,BC       */
OP(op,0a) { A = RM(z,BC);	MEMPTR=BC+1;    					} /* LD   A,(BC)      */
OP(op,0b) { BC--; 																} /* DEC  BC          */
OP(op,0c) { C = INC(C);												} /* INC  C           */
OP(op,0d) { C = DEC(C);												} /* DEC  C           */
OP(op,0e) { C = ARG();														} /* LD   C,n         */
OP(op,0f) { RRCA(z80);																} /* RRCA             */

OP(op,10) { B--; JR_COND(z80, B, 0x10);									} /* DJNZ o           */
OP(op,11) { DE = ARG16();													} /* LD   DE,w        */
OP(op,12) { WM(z80,DE,A); MEMPTR_L = (DE + 1) & 0xFF;  MEMPTR_H = A; } /* LD   (DE),A      */
OP(op,13) { DE++;																} /* INC  DE          */
OP(op,14) { D = INC(D);												} /* INC  D           */
OP(op,15) { D = DEC(D);												} /* DEC  D           */
OP(op,16) { D = ARG();														} /* LD   D,n         */
OP(op,17) { RLA(z80);																} /* RLA              */

OP(op,18) { JR(z80);																} /* JR   o           */
OP(op,19) { ADD16(z80, hl, de);														} /* ADD  HL,DE       */
OP(op,1a) { A = RM(z80, DE); MEMPTR=DE+1;						} /* LD   A,(DE)      */
OP(op,1b) { DE--; 																} /* DEC  DE          */
OP(op,1c) { E = INC(E);												} /* INC  E           */
OP(op,1d) { E = DEC(E);												} /* DEC  E           */
OP(op,1e) { E = ARG();														} /* LD   E,n         */
OP(op,1f) { RRA(z80);																} /* RRA              */

OP(op,20) { JR_COND(z80, !(F & ZF), 0x20);										} /* JR   NZ,o        */
OP(op,21) { HL = ARG16();													} /* LD   HL,w        */
OP(op,22) { ea = ARG16(); WM16(ea, &hl);	MEMPTR = ea+1; } /* LD   (w),HL      */
OP(op,23) { HL++;																} /* INC  HL          */
OP(op,24) { H = INC(H);												} /* INC  H           */
OP(op,25) { H = DEC(H);												} /* DEC  H           */
OP(op,26) { H = ARG();														} /* LD   H,n         */
OP(op,27) { DAA(z80);																} /* DAA              */

OP(op,28) { JR_COND(z80, F & ZF, 0x28);										} /* JR   Z,o         */
OP(op,29) { ADD16(z80, hl, hl);														} /* ADD  HL,HL       */
OP(op,2a) { ea = ARG16(); RM16(ea, &hl);	MEMPTR = ea+1; } /* LD   HL,(w)      */
OP(op,2b) { HL--; 																} /* DEC  HL          */
OP(op,2c) { L = INC(L);												} /* INC  L           */
OP(op,2d) { L = DEC(L);												} /* DEC  L           */
OP(op,2e) { L = ARG();														} /* LD   L,n         */
OP(op,2f) { A ^= 0xff; F = (F&(SF|ZF|PF|CF))|HF|NF|(A&(YF|XF));	} /* CPL              */

OP(op,30) { JR_COND(z80, !(F & CF), 0x30);										} /* JR   NC,o        */
OP(op,31) { SP = ARG16();													} /* LD   SP,w        */
OP(op,32) { ea=ARG16();WM(z80,ea,A);MEMPTR_L=(ea+1)&0xFF;MEMPTR_H=A; } /* LD   (w),A       */
OP(op,33) { SP++;																} /* INC  SP          */
OP(op,34) { WM(z80, HL, INC(RM(z80, HL)));							} /* INC  (HL)        */
OP(op,35) { WM(z80, HL, DEC(RM(z80, HL)));							} /* DEC  (HL)        */
OP(op,36) { WM(z80, HL, ARG());												} /* LD   (HL),n      */
OP(op,37) { F = (F & (SF|ZF|PF)) | CF | (A & (YF|XF));				} /* SCF              */

OP(op,38) { JR_COND(z80, F & CF, 0x38);										} /* JR   C,o         */
OP(op,39) { ADD16(z80, hl, sp);														} /* ADD  HL,SP       */
OP(op,3a) { ea = ARG16(); A = RM(z80, ea); MEMPTR=ea+1;	             } /* LD   A,(w)       */
OP(op,3b) { SP--;																} /* DEC  SP          */
OP(op,3c) { A = INC(A);												} /* INC  A           */
OP(op,3d) { A = DEC(A);												} /* DEC  A           */
OP(op,3e) { A = ARG();														} /* LD   A,n         */
OP(op,3f) { F = ((F&(SF|ZF|PF|CF))|((F&CF)<<4)|(A&(YF|XF)))^CF;	} /* CCF              */

OP(op,40) {																			} /* LD   B,B         */
OP(op,41) { B = C;														} /* LD   B,C         */
OP(op,42) { B = D;														} /* LD   B,D         */
OP(op,43) { B = E;														} /* LD   B,E         */
OP(op,44) { B = H;														} /* LD   B,H         */
OP(op,45) { B = L;														} /* LD   B,L         */
OP(op,46) { B = RM(z80, HL);												} /* LD   B,(HL)      */
OP(op,47) { B = A;														} /* LD   B,A         */

OP(op,48) { C = B;														} /* LD   C,B         */
OP(op,49) {																			} /* LD   C,C         */
OP(op,4a) { C = D;														} /* LD   C,D         */
OP(op,4b) { C = E;														} /* LD   C,E         */
OP(op,4c) { C = H;														} /* LD   C,H         */
OP(op,4d) { C = L;														} /* LD   C,L         */
OP(op,4e) { C = RM(z80, HL);												} /* LD   C,(HL)      */
OP(op,4f) { C = A;														} /* LD   C,A         */

OP(op,50) { D = B;														} /* LD   D,B         */
OP(op,51) { D = C;														} /* LD   D,C         */
OP(op,52) {																			} /* LD   D,D         */
OP(op,53) { D = E;														} /* LD   D,E         */
OP(op,54) { D = H;														} /* LD   D,H         */
OP(op,55) { D = L;														} /* LD   D,L         */
OP(op,56) { D = RM(z80, HL);												} /* LD   D,(HL)      */
OP(op,57) { D = A;														} /* LD   D,A         */

OP(op,58) { E = B;														} /* LD   E,B         */
OP(op,59) { E = C;														} /* LD   E,C         */
OP(op,5a) { E = D;														} /* LD   E,D         */
OP(op,5b) {																			} /* LD   E,E         */
OP(op,5c) { E = H;														} /* LD   E,H         */
OP(op,5d) { E = L;														} /* LD   E,L         */
OP(op,5e) { E = RM(z80, HL);												} /* LD   E,(HL)      */
OP(op,5f) { E = A;														} /* LD   E,A         */

OP(op,60) { H = B;														} /* LD   H,B         */
OP(op,61) { H = C;														} /* LD   H,C         */
OP(op,62) { H = D;														} /* LD   H,D         */
OP(op,63) { H = E;														} /* LD   H,E         */
OP(op,64) {																			} /* LD   H,H         */
OP(op,65) { H = L;														} /* LD   H,L         */
OP(op,66) { H = RM(z80, HL);												} /* LD   H,(HL)      */
OP(op,67) { H = A;														} /* LD   H,A         */

OP(op,68) { L = B;														} /* LD   L,B         */
OP(op,69) { L = C;														} /* LD   L,C         */
OP(op,6a) { L = D;														} /* LD   L,D         */
OP(op,6b) { L = E;														} /* LD   L,E         */
OP(op,6c) { L = H;														} /* LD   L,H         */
OP(op,6d) {																			} /* LD   L,L         */
OP(op,6e) { L = RM(z80, HL);												} /* LD   L,(HL)      */
OP(op,6f) { L = A;														} /* LD   L,A         */

OP(op,70) { WM(z80, HL, B);												} /* LD   (HL),B      */
OP(op,71) { WM(z80, HL, C);												} /* LD   (HL),C      */
OP(op,72) { WM(z80, HL, D);												} /* LD   (HL),D      */
OP(op,73) { WM(z80, HL, E);												} /* LD   (HL),E      */
OP(op,74) { WM(z80, HL, H);												} /* LD   (HL),H      */
OP(op,75) { WM(z80, HL, L);												} /* LD   (HL),L      */
OP(op,76) { ENTER_HALT(z80);														} /* halt             */
OP(op,77) { WM(z80, HL, A);												} /* LD   (HL),A      */

OP(op,78) { A = B;														} /* LD   A,B         */
OP(op,79) { A = C;														} /* LD   A,C         */
OP(op,7a) { A = D;														} /* LD   A,D         */
OP(op,7b) { A = E;														} /* LD   A,E         */
OP(op,7c) { A = H;														} /* LD   A,H         */
OP(op,7d) { A = L;														} /* LD   A,L         */
OP(op,7e) { A = RM(z80, HL);												} /* LD   A,(HL)      */
OP(op,7f) {																			} /* LD   A,A         */

OP(op,80) { ADD(z80, B);														} /* ADD  A,B         */
OP(op,81) { ADD(z80, C);														} /* ADD  A,C         */
OP(op,82) { ADD(z80, D);														} /* ADD  A,D         */
OP(op,83) { ADD(z80, E);														} /* ADD  A,E         */
OP(op,84) { ADD(z80, H);														} /* ADD  A,H         */
OP(op,85) { ADD(z80, L);														} /* ADD  A,L         */
OP(op,86) { ADD(z80, RM(z80, HL));												} /* ADD  A,(HL)      */
OP(op,87) { ADD(z80, A);														} /* ADD  A,A         */

OP(op,88) { ADC(z80, B);														} /* ADC  A,B         */
OP(op,89) { ADC(z80, C);														} /* ADC  A,C         */
OP(op,8a) { ADC(z80, D);														} /* ADC  A,D         */
OP(op,8b) { ADC(z80, E);														} /* ADC  A,E         */
OP(op,8c) { ADC(z80, H);														} /* ADC  A,H         */
OP(op,8d) { ADC(z80, L);														} /* ADC  A,L         */
OP(op,8e) { ADC(z80, RM(z80, HL));												} /* ADC  A,(HL)      */
OP(op,8f) { ADC(z80, A);														} /* ADC  A,A         */

OP(op,90) { SUB(z80, B);														} /* SUB  B           */
OP(op,91) { SUB(z80, C);														} /* SUB  C           */
OP(op,92) { SUB(z80, D);														} /* SUB  D           */
OP(op,93) { SUB(z80, E);														} /* SUB  E           */
OP(op,94) { SUB(z80, H);														} /* SUB  H           */
OP(op,95) { SUB(z80, L);														} /* SUB  L           */
OP(op,96) { SUB(z80, RM(z80, HL));												} /* SUB  (HL)        */
OP(op,97) { SUB(z80, A);														} /* SUB  A           */

OP(op,98) { SBC(z80, B);														} /* SBC  A,B         */
OP(op,99) { SBC(z80, C);														} /* SBC  A,C         */
OP(op,9a) { SBC(z80, D);														} /* SBC  A,D         */
OP(op,9b) { SBC(z80, E);														} /* SBC  A,E         */
OP(op,9c) { SBC(z80, H);														} /* SBC  A,H         */
OP(op,9d) { SBC(z80, L);														} /* SBC  A,L         */
OP(op,9e) { SBC(z80, RM(z80, HL));												} /* SBC  A,(HL)      */
OP(op,9f) { SBC(z80, A);														} /* SBC  A,A         */

OP(op,a0) { AND(z80, B);														} /* AND  B           */
OP(op,a1) { AND(z80, C);														} /* AND  C           */
OP(op,a2) { AND(z80, D);														} /* AND  D           */
OP(op,a3) { AND(z80, E);														} /* AND  E           */
OP(op,a4) { AND(z80, H);														} /* AND  H           */
OP(op,a5) { AND(z80, L);														} /* AND  L           */
OP(op,a6) { AND(z80, RM(z80, HL));												} /* AND  (HL)        */
OP(op,a7) { AND(z80, A);														} /* AND  A           */

OP(op,a8) { XOR(z80, B);														} /* XOR  B           */
OP(op,a9) { XOR(z80, C);														} /* XOR  C           */
OP(op,aa) { XOR(z80, D);														} /* XOR  D           */
OP(op,ab) { XOR(z80, E);														} /* XOR  E           */
OP(op,ac) { XOR(z80, H);														} /* XOR  H           */
OP(op,ad) { XOR(z80, L);														} /* XOR  L           */
OP(op,ae) { XOR(z80, RM(z80, HL));												} /* XOR  (HL)        */
OP(op,af) { XOR(z80, A);														} /* XOR  A           */

OP(op,b0) { OR(z80, B);														} /* OR   B           */
OP(op,b1) { OR(z80, C);														} /* OR   C           */
OP(op,b2) { OR(z80, D);														} /* OR   D           */
OP(op,b3) { OR(z80, E);														} /* OR   E           */
OP(op,b4) { OR(z80, H);														} /* OR   H           */
OP(op,b5) { OR(z80, L);														} /* OR   L           */
OP(op,b6) { OR(z80, RM(z80, HL));												} /* OR   (HL)        */
OP(op,b7) { OR(z80, A);														} /* OR   A           */

OP(op,b8) { CP(z80, B);														} /* CP   B           */
OP(op,b9) { CP(z80, C);														} /* CP   C           */
OP(op,ba) { CP(z80, D);														} /* CP   D           */
OP(op,bb) { CP(z80, E);														} /* CP   E           */
OP(op,bc) { CP(z80, H);														} /* CP   H           */
OP(op,bd) { CP(z80, L);														} /* CP   L           */
OP(op,be) { CP(z80, RM(z80, HL));												} /* CP   (HL)        */
OP(op,bf) { CP(z80, A);														} /* CP   A           */

OP(op,c0) { RET_COND(z80, !(F & ZF), 0xc0);									} /* RET  NZ          */
OP(op,c1) { POP(z80, bc);															} /* POP  BC          */
OP(op,c2) { JP_COND(z80, !(F & ZF));											} /* JP   NZ,a        */
OP(op,c3) { JP(z80);																} /* JP   a           */
OP(op,c4) { CALL_COND(z80, !(F & ZF), 0xc4);									} /* CALL NZ,a        */
OP(op,c5) { PUSH(z80, bc);															} /* PUSH BC          */
OP(op,c6) { ADD(z80, ARG());														} /* ADD  A,n         */
OP(op,c7) { RST(z80, 0x00);															} /* RST  0           */

OP(op,c8) { RET_COND(z80, F & ZF, 0xc8);										} /* RET  Z           */
OP(op,c9) { POP(z80, pc); MEMPTR=PCD;										} /* RET              */
OP(op,ca) { JP_COND(z80, F & ZF);												} /* JP   Z,a         */
OP(op,cb) { r++; EXEC(z80,cb,ROP());										} /* **** CB xx       */
OP(op,cc) { CALL_COND(z80, F & ZF, 0xcc);										} /* CALL Z,a         */
OP(op,cd) { CALL(z80);																} /* CALL a           */
OP(op,ce) { ADC(z80, ARG());														} /* ADC  A,n         */
OP(op,cf) { RST(z80, 0x08);															} /* RST  1           */

OP(op,d0) { RET_COND(z80, !(F & CF), 0xd0);									} /* RET  NC          */
OP(op,d1) { POP(z80, de);															} /* POP  DE          */
OP(op,d2) { JP_COND(z80, !(F & CF));											} /* JP   NC,a        */
OP(op,d3) { unsigned n = ARG() | (A << 8); OUT(z80, n, A);	MEMPTR_L = ((n & 0xff) + 1) & 0xff;  MEMPTR_H = A;	} /* OUT  (n),A       */
OP(op,d4) { CALL_COND(z80, !(F & CF), 0xd4);									} /* CALL NC,a        */
OP(op,d5) { PUSH(z80, de);															} /* PUSH DE          */
OP(op,d6) { SUB(z80, ARG());														} /* SUB  n           */
OP(op,d7) { RST(z80, 0x10);															} /* RST  2           */

OP(op,d8) { RET_COND(z80, F & CF, 0xd8);										} /* RET  C           */
OP(op,d9) { EXX(z80);																} /* EXX              */
OP(op,da) { JP_COND(z80, F & CF);												} /* JP   C,a         */
OP(op,db) { unsigned n = ARG() | (A << 8); A = IN(z80, n);	MEMPTR = n + 1; } /* IN   A,(n)       */
OP(op,dc) { CALL_COND(z80, F & CF, 0xdc);										} /* CALL C,a         */
OP(op,dd) { r++; EXEC(z80,dd,ROP());										} /* **** DD xx       */
OP(op,de) { SBC(z80, ARG());														} /* SBC  A,n         */
OP(op,df) { RST(z80, 0x18);															} /* RST  3           */

OP(op,e0) { RET_COND(z80, !(F & PF), 0xe0);									} /* RET  PO          */
OP(op,e1) { POP(z80, hl);															} /* POP  HL          */
OP(op,e2) { JP_COND(z80, !(F & PF));											} /* JP   PO,a        */
OP(op,e3) { EXSP(z80, hl);															} /* EX   HL,(SP)     */
OP(op,e4) { CALL_COND(z80, !(F & PF), 0xe4);									} /* CALL PO,a        */
OP(op,e5) { PUSH(z80, hl);															} /* PUSH HL          */
OP(op,e6) { AND(z80, ARG());														} /* AND  n           */
OP(op,e7) { RST(z80, 0x20);															} /* RST  4           */

OP(op,e8) { RET_COND(z80, F & PF, 0xe8);										} /* RET  PE          */
OP(op,e9) { PC = HL; 														} /* JP   (HL)        */
OP(op,ea) { JP_COND(z80, F & PF);												} /* JP   PE,a        */
OP(op,eb) { EX_DE_HL(z80);															} /* EX   DE,HL       */
OP(op,ec) { CALL_COND(z80, F & PF, 0xec);										} /* CALL PE,a        */
OP(op,ed) { r++; EXEC(z80,ed,ROP());										} /* **** ED xx       */
OP(op,ee) { XOR(z80, ARG());														} /* XOR  n           */
OP(op,ef) { RST(z80, 0x28);															} /* RST  5           */

OP(op,f0) { RET_COND(z80, !(F & SF), 0xf0);									} /* RET  P           */
OP(op,f1) { POP(z80, af);															} /* POP  AF          */
OP(op,f2) { JP_COND(z80, !(F & SF));											} /* JP   P,a         */
OP(op,f3) { iff1 = iff2 = 0;												} /* DI               */
OP(op,f4) { CALL_COND(z80, !(F & SF), 0xf4);									} /* CALL P,a         */
OP(op,f5) { PUSH(z80, af);															} /* PUSH AF          */
OP(op,f6) { OR(z80, ARG());														} /* OR   n           */
OP(op,f7) { RST(z80, 0x30);															} /* RST  6           */

OP(op,f8) { RET_COND(z80, F & SF, 0xf8);										} /* RET  M           */
OP(op,f9) { SP = HL;														} /* LD   SP,HL       */
OP(op,fa) { JP_COND(z80, F & SF);												} /* JP   M,a         */
OP(op,fb) { EI(z80);																} /* EI               */
OP(op,fc) { CALL_COND(z80, F & SF, 0xfc);										} /* CALL M,a         */
OP(op,fd) { r++; EXEC(z80,fd,ROP());										} /* **** FD xx       */
OP(op,fe) { CP(z80, ARG());														} /* CP   n           */
OP(op,ff) { RST(z80, 0x38);															} /* RST  7           */

/**********************************************************
 * IY register related opcodes (FD prefix)
 **********************************************************/
OP(fd,00) { IllegalOpcode(0xfd); op_00();												} /* DB   FD          */
OP(fd,01) { IllegalOpcode(0xfd); op_01();												} /* DB   FD          */
OP(fd,02) { IllegalOpcode(0xfd); op_02();												} /* DB   FD          */
OP(fd,03) { IllegalOpcode(0xfd); op_03();												} /* DB   FD          */
OP(fd,04) { IllegalOpcode(0xfd); op_04();												} /* DB   FD          */
OP(fd,05) { IllegalOpcode(0xfd); op_05();												} /* DB   FD          */
OP(fd,06) { IllegalOpcode(0xfd); op_06();												} /* DB   FD          */
OP(fd,07) { IllegalOpcode(0xfd); op_07();												} /* DB   FD          */

OP(fd,08) { IllegalOpcode(0xfd); op_08();												} /* DB   FD          */
OP(fd,09) { ADD16(z80, iy, bc);														} /* ADD  IY,BC       */
OP(fd,0a) { IllegalOpcode(0xfd); op_0a();												} /* DB   FD          */
OP(fd,0b) { IllegalOpcode(0xfd); op_0b();												} /* DB   FD          */
OP(fd,0c) { IllegalOpcode(0xfd); op_0c();												} /* DB   FD          */
OP(fd,0d) { IllegalOpcode(0xfd); op_0d();												} /* DB   FD          */
OP(fd,0e) { IllegalOpcode(0xfd); op_0e();												} /* DB   FD          */
OP(fd,0f) { IllegalOpcode(0xfd); op_0f();												} /* DB   FD          */

OP(fd,10) { IllegalOpcode(0xfd); op_10();												} /* DB   FD          */
OP(fd,11) { IllegalOpcode(0xfd); op_11();												} /* DB   FD          */
OP(fd,12) { IllegalOpcode(0xfd); op_12();												} /* DB   FD          */
OP(fd,13) { IllegalOpcode(0xfd); op_13();												} /* DB   FD          */
OP(fd,14) { IllegalOpcode(0xfd); op_14();												} /* DB   FD          */
OP(fd,15) { IllegalOpcode(0xfd); op_15();												} /* DB   FD          */
OP(fd,16) { IllegalOpcode(0xfd); op_16();												} /* DB   FD          */
OP(fd,17) { IllegalOpcode(0xfd); op_17();												} /* DB   FD          */

OP(fd,18) { IllegalOpcode(0xfd); op_18();												} /* DB   FD          */
OP(fd,19) { ADD16(z80, iy, de);														} /* ADD  IY,DE       */
OP(fd,1a) { IllegalOpcode(0xfd); op_1a();												} /* DB   FD          */
OP(fd,1b) { IllegalOpcode(0xfd); op_1b();												} /* DB   FD          */
OP(fd,1c) { IllegalOpcode(0xfd); op_1c();												} /* DB   FD          */
OP(fd,1d) { IllegalOpcode(0xfd); op_1d();												} /* DB   FD          */
OP(fd,1e) { IllegalOpcode(0xfd); op_1e();												} /* DB   FD          */
OP(fd,1f) { IllegalOpcode(0xfd); op_1f();												} /* DB   FD          */

OP(fd,20) { IllegalOpcode(0xfd); op_20();												} /* DB   FD          */
OP(fd,21) { IY = ARG16();													} /* LD   IY,w        */
OP(fd,22) { ea = ARG16(); WM16(ea, &iy); MEMPTR = ea+1; } /* LD   (w),IY      */
OP(fd,23) { IY++;																} /* INC  IY          */
OP(fd,24) { HY = INC(HY);											} /* INC  HY          */
OP(fd,25) { HY = DEC(HY);											} /* DEC  HY          */
OP(fd,26) { HY = ARG();														} /* LD   HY,n        */
OP(fd,27) { IllegalOpcode(0xfd); op_27();												} /* DB   FD          */

OP(fd,28) { IllegalOpcode(0xfd); op_28();												} /* DB   FD          */
OP(fd,29) { ADD16(z80, iy, iy);														} /* ADD  IY,IY       */
OP(fd,2a) { ea = ARG16(); RM16(ea, &iy); MEMPTR = ea+1; } /* LD   IY,(w)      */
OP(fd,2b) { IY--;																} /* DEC  IY          */
OP(fd,2c) { LY = INC(LY);											} /* INC  LY          */
OP(fd,2d) { LY = DEC(LY);											} /* DEC  LY          */
OP(fd,2e) { LY = ARG();														} /* LD   LY,n        */
OP(fd,2f) { IllegalOpcode(0xfd); op_2f();												} /* DB   FD          */

OP(fd,30) { IllegalOpcode(0xfd); op_30();												} /* DB   FD          */
OP(fd,31) { IllegalOpcode(0xfd); op_31();												} /* DB   FD          */
OP(fd,32) { IllegalOpcode(0xfd); op_32();												} /* DB   FD          */
OP(fd,33) { IllegalOpcode(0xfd); op_33();												} /* DB   FD          */
OP(fd,34) { EAY(z80); WM(z80, ea, INC(RM(z80, ea)));					} /* INC  (IY+o)      */
OP(fd,35) { EAY(z80); WM(z80, ea, DEC(RM(z80, ea)));					} /* DEC  (IY+o)      */
OP(fd,36) { EAY(z80); WM(z80, ea, ARG());									} /* LD   (IY+o),n    */
OP(fd,37) { IllegalOpcode(0xfd); op_37();												} /* DB   FD          */

OP(fd,38) { IllegalOpcode(0xfd); op_38();												} /* DB   FD          */
OP(fd,39) { ADD16(z80, iy, sp);														} /* ADD  IY,SP       */
OP(fd,3a) { IllegalOpcode(0xfd); op_3a();												} /* DB   FD          */
OP(fd,3b) { IllegalOpcode(0xfd); op_3b();												} /* DB   FD          */
OP(fd,3c) { IllegalOpcode(0xfd); op_3c();												} /* DB   FD          */
OP(fd,3d) { IllegalOpcode(0xfd); op_3d();												} /* DB   FD          */
OP(fd,3e) { IllegalOpcode(0xfd); op_3e();												} /* DB   FD          */
OP(fd,3f) { IllegalOpcode(0xfd); op_3f();												} /* DB   FD          */

OP(fd,40) { IllegalOpcode(0xfd); op_40();												} /* DB   FD          */
OP(fd,41) { IllegalOpcode(0xfd); op_41();												} /* DB   FD          */
OP(fd,42) { IllegalOpcode(0xfd); op_42();												} /* DB   FD          */
OP(fd,43) { IllegalOpcode(0xfd); op_43();												} /* DB   FD          */
OP(fd,44) { B = HY;														} /* LD   B,HY        */
OP(fd,45) { B = LY;														} /* LD   B,LY        */
OP(fd,46) { EAY(z80); B = RM(z80, ea);									} /* LD   B,(IY+o)    */
OP(fd,47) { IllegalOpcode(0xfd); op_47();												} /* DB   FD          */

OP(fd,48) { IllegalOpcode(0xfd); op_48();												} /* DB   FD          */
OP(fd,49) { IllegalOpcode(0xfd); op_49();												} /* DB   FD          */
OP(fd,4a) { IllegalOpcode(0xfd); op_4a();												} /* DB   FD          */
OP(fd,4b) { IllegalOpcode(0xfd); op_4b();												} /* DB   FD          */
OP(fd,4c) { C = HY;														} /* LD   C,HY        */
OP(fd,4d) { C = LY;														} /* LD   C,LY        */
OP(fd,4e) { EAY(z80); C = RM(z80, ea);									} /* LD   C,(IY+o)    */
OP(fd,4f) { IllegalOpcode(0xfd); op_4f();												} /* DB   FD          */

OP(fd,50) { IllegalOpcode(0xfd); op_50();												} /* DB   FD          */
OP(fd,51) { IllegalOpcode(0xfd); op_51();												} /* DB   FD          */
OP(fd,52) { IllegalOpcode(0xfd); op_52();												} /* DB   FD          */
OP(fd,53) { IllegalOpcode(0xfd); op_53();												} /* DB   FD          */
OP(fd,54) { D = HY;														} /* LD   D,HY        */
OP(fd,55) { D = LY;														} /* LD   D,LY        */
OP(fd,56) { EAY(z80); D = RM(z80, ea);									} /* LD   D,(IY+o)    */
OP(fd,57) { IllegalOpcode(0xfd); op_57();												} /* DB   FD          */

OP(fd,58) { IllegalOpcode(0xfd); op_58();												} /* DB   FD          */
OP(fd,59) { IllegalOpcode(0xfd); op_59();												} /* DB   FD          */
OP(fd,5a) { IllegalOpcode(0xfd); op_5a();												} /* DB   FD          */
OP(fd,5b) { IllegalOpcode(0xfd); op_5b();												} /* DB   FD          */
OP(fd,5c) { E = HY;														} /* LD   E,HY        */
OP(fd,5d) { E = LY;														} /* LD   E,LY        */
OP(fd,5e) { EAY(z80); E = RM(z80, ea);									} /* LD   E,(IY+o)    */
OP(fd,5f) { IllegalOpcode(0xfd); op_5f();												} /* DB   FD          */

OP(fd,60) { HY = B;														} /* LD   HY,B        */
OP(fd,61) { HY = C;														} /* LD   HY,C        */
OP(fd,62) { HY = D;														} /* LD   HY,D        */
OP(fd,63) { HY = E;														} /* LD   HY,E        */
OP(fd,64) {																			} /* LD   HY,HY       */
OP(fd,65) { HY = LY;														} /* LD   HY,LY       */
OP(fd,66) { EAY(z80); H = RM(z80, ea);									} /* LD   H,(IY+o)    */
OP(fd,67) { HY = A;														} /* LD   HY,A        */

OP(fd,68) { LY = B;														} /* LD   LY,B        */
OP(fd,69) { LY = C;														} /* LD   LY,C        */
OP(fd,6a) { LY = D;														} /* LD   LY,D        */
OP(fd,6b) { LY = E;														} /* LD   LY,E        */
OP(fd,6c) { LY = HY;														} /* LD   LY,HY       */
OP(fd,6d) {																			} /* LD   LY,LY       */
OP(fd,6e) { EAY(z80); L = RM(z80, ea);									} /* LD   L,(IY+o)    */
OP(fd,6f) { LY = A;														} /* LD   LY,A        */

OP(fd,70) { EAY(z80); WM(z80, ea, B);										} /* LD   (IY+o),B    */
OP(fd,71) { EAY(z80); WM(z80, ea, C);										} /* LD   (IY+o),C    */
OP(fd,72) { EAY(z80); WM(z80, ea, D);										} /* LD   (IY+o),D    */
OP(fd,73) { EAY(z80); WM(z80, ea, E);										} /* LD   (IY+o),E    */
OP(fd,74) { EAY(z80); WM(z80, ea, H);										} /* LD   (IY+o),H    */
OP(fd,75) { EAY(z80); WM(z80, ea, L);										} /* LD   (IY+o),L    */
OP(fd,76) { IllegalOpcode(0xfd); op_76();												} /* DB   FD          */
OP(fd,77) { EAY(z80); WM(z80, ea, A);										} /* LD   (IY+o),A    */

OP(fd,78) { IllegalOpcode(0xfd); op_78();												} /* DB   FD          */
OP(fd,79) { IllegalOpcode(0xfd); op_79();												} /* DB   FD          */
OP(fd,7a) { IllegalOpcode(0xfd); op_7a();												} /* DB   FD          */
OP(fd,7b) { IllegalOpcode(0xfd); op_7b();												} /* DB   FD          */
OP(fd,7c) { A = HY;														} /* LD   A,HY        */
OP(fd,7d) { A = LY;														} /* LD   A,LY        */
OP(fd,7e) { EAY(z80); A = RM(z80, ea);									} /* LD   A,(IY+o)    */
OP(fd,7f) { IllegalOpcode(0xfd); op_7f();												} /* DB   FD          */

OP(fd,80) { IllegalOpcode(0xfd); op_80();												} /* DB   FD          */
OP(fd,81) { IllegalOpcode(0xfd); op_81();												} /* DB   FD          */
OP(fd,82) { IllegalOpcode(0xfd); op_82();												} /* DB   FD          */
OP(fd,83) { IllegalOpcode(0xfd); op_83();												} /* DB   FD          */
OP(fd,84) { ADD(z80, HY);														} /* ADD  A,HY        */
OP(fd,85) { ADD(z80, LY);														} /* ADD  A,LY        */
OP(fd,86) { EAY(z80); ADD(z80, RM(z80, ea));									} /* ADD  A,(IY+o)    */
OP(fd,87) { IllegalOpcode(0xfd); op_87();												} /* DB   FD          */

OP(fd,88) { IllegalOpcode(0xfd); op_88();												} /* DB   FD          */
OP(fd,89) { IllegalOpcode(0xfd); op_89();												} /* DB   FD          */
OP(fd,8a) { IllegalOpcode(0xfd); op_8a();												} /* DB   FD          */
OP(fd,8b) { IllegalOpcode(0xfd); op_8b();												} /* DB   FD          */
OP(fd,8c) { ADC(z80, HY);														} /* ADC  A,HY        */
OP(fd,8d) { ADC(z80, LY);														} /* ADC  A,LY        */
OP(fd,8e) { EAY(z80); ADC(z80, RM(z80, ea));									} /* ADC  A,(IY+o)    */
OP(fd,8f) { IllegalOpcode(0xfd); op_8f();												} /* DB   FD          */

OP(fd,90) { IllegalOpcode(0xfd); op_90();												} /* DB   FD          */
OP(fd,91) { IllegalOpcode(0xfd); op_91();												} /* DB   FD          */
OP(fd,92) { IllegalOpcode(0xfd); op_92();												} /* DB   FD          */
OP(fd,93) { IllegalOpcode(0xfd); op_93();												} /* DB   FD          */
OP(fd,94) { SUB(z80, HY);														} /* SUB  HY          */
OP(fd,95) { SUB(z80, LY);														} /* SUB  LY          */
OP(fd,96) { EAY(z80); SUB(z80, RM(z80, ea));									} /* SUB  (IY+o)      */
OP(fd,97) { IllegalOpcode(0xfd); op_97();												} /* DB   FD          */

OP(fd,98) { IllegalOpcode(0xfd); op_98();												} /* DB   FD          */
OP(fd,99) { IllegalOpcode(0xfd); op_99();												} /* DB   FD          */
OP(fd,9a) { IllegalOpcode(0xfd); op_9a();												} /* DB   FD          */
OP(fd,9b) { IllegalOpcode(0xfd); op_9b();												} /* DB   FD          */
OP(fd,9c) { SBC(z80, HY);														} /* SBC  A,HY        */
OP(fd,9d) { SBC(z80, LY);														} /* SBC  A,LY        */
OP(fd,9e) { EAY(z80); SBC(z80, RM(z80, ea));									} /* SBC  A,(IY+o)    */
OP(fd,9f) { IllegalOpcode(0xfd); op_9f();												} /* DB   FD          */

OP(fd,a0) { IllegalOpcode(0xfd); op_a0();												} /* DB   FD          */
OP(fd,a1) { IllegalOpcode(0xfd); op_a1();												} /* DB   FD          */
OP(fd,a2) { IllegalOpcode(0xfd); op_a2();												} /* DB   FD          */
OP(fd,a3) { IllegalOpcode(0xfd); op_a3();												} /* DB   FD          */
OP(fd,a4) { AND(z80, HY);														} /* AND  HY          */
OP(fd,a5) { AND(z80, LY);														} /* AND  LY          */
OP(fd,a6) { EAY(z80); AND(z80, RM(z80, ea));									} /* AND  (IY+o)      */
OP(fd,a7) { IllegalOpcode(0xfd); op_a7();												} /* DB   FD          */

OP(fd,a8) { IllegalOpcode(0xfd); op_a8();												} /* DB   FD          */
OP(fd,a9) { IllegalOpcode(0xfd); op_a9();												} /* DB   FD          */
OP(fd,aa) { IllegalOpcode(0xfd); op_aa();												} /* DB   FD          */
OP(fd,ab) { IllegalOpcode(0xfd); op_ab();												} /* DB   FD          */
OP(fd,ac) { XOR(z80, HY);														} /* XOR  HY          */
OP(fd,ad) { XOR(z80, LY);														} /* XOR  LY          */
OP(fd,ae) { EAY(z80); XOR(z80, RM(z80, ea));									} /* XOR  (IY+o)      */
OP(fd,af) { IllegalOpcode(0xfd); op_af();												} /* DB   FD          */

OP(fd,b0) { IllegalOpcode(0xfd); op_b0();												} /* DB   FD          */
OP(fd,b1) { IllegalOpcode(0xfd); op_b1();												} /* DB   FD          */
OP(fd,b2) { IllegalOpcode(0xfd); op_b2();												} /* DB   FD          */
OP(fd,b3) { IllegalOpcode(0xfd); op_b3();												} /* DB   FD          */
OP(fd,b4) { OR(z80, HY);														} /* OR   HY          */
OP(fd,b5) { OR(z80, LY);														} /* OR   LY          */
OP(fd,b6) { EAY(z80); OR(z80, RM(z80, ea));									} /* OR   (IY+o)      */
OP(fd,b7) { IllegalOpcode(0xfd); op_b7();												} /* DB   FD          */

OP(fd,b8) { IllegalOpcode(0xfd); op_b8();												} /* DB   FD          */
OP(fd,b9) { IllegalOpcode(0xfd); op_b9();												} /* DB   FD          */
OP(fd,ba) { IllegalOpcode(0xfd); op_ba();												} /* DB   FD          */
OP(fd,bb) { IllegalOpcode(0xfd); op_bb();												} /* DB   FD          */
OP(fd,bc) { CP(z80, HY);														} /* CP   HY          */
OP(fd,bd) { CP(z80, LY);														} /* CP   LY          */
OP(fd,be) { EAY(z80); CP(z80, RM(z80, ea));									} /* CP   (IY+o)      */
OP(fd,bf) { IllegalOpcode(0xfd); op_bf();												} /* DB   FD          */

OP(fd,c0) { IllegalOpcode(0xfd); op_c0();												} /* DB   FD          */
OP(fd,c1) { IllegalOpcode(0xfd); op_c1();												} /* DB   FD          */
OP(fd,c2) { IllegalOpcode(0xfd); op_c2();												} /* DB   FD          */
OP(fd,c3) { IllegalOpcode(0xfd); op_c3();												} /* DB   FD          */
OP(fd,c4) { IllegalOpcode(0xfd); op_c4();												} /* DB   FD          */
OP(fd,c5) { IllegalOpcode(0xfd); op_c5();												} /* DB   FD          */
OP(fd,c6) { IllegalOpcode(0xfd); op_c6();												} /* DB   FD          */
OP(fd,c7) { IllegalOpcode(0xfd); op_c7();												} /* DB   FD          */

OP(fd,c8) { IllegalOpcode(0xfd); op_c8();												} /* DB   FD          */
OP(fd,c9) { IllegalOpcode(0xfd); op_c9();												} /* DB   FD          */
OP(fd,ca) { IllegalOpcode(0xfd); op_ca();												} /* DB   FD          */
OP(fd,cb) { EAY(z80); EXEC(z80,xycb,ARG());										} /* **   FD CB xx    */
OP(fd,cc) { IllegalOpcode(0xfd); op_cc();												} /* DB   FD          */
OP(fd,cd) { IllegalOpcode(0xfd); op_cd();												} /* DB   FD          */
OP(fd,ce) { IllegalOpcode(0xfd); op_ce();												} /* DB   FD          */
OP(fd,cf) { IllegalOpcode(0xfd); op_cf();												} /* DB   FD          */

OP(fd,d0) { IllegalOpcode(0xfd); op_d0();												} /* DB   FD          */
OP(fd,d1) { IllegalOpcode(0xfd); op_d1();												} /* DB   FD          */
OP(fd,d2) { IllegalOpcode(0xfd); op_d2();												} /* DB   FD          */
OP(fd,d3) { IllegalOpcode(0xfd); op_d3();												} /* DB   FD          */
OP(fd,d4) { IllegalOpcode(0xfd); op_d4();												} /* DB   FD          */
OP(fd,d5) { IllegalOpcode(0xfd); op_d5();												} /* DB   FD          */
OP(fd,d6) { IllegalOpcode(0xfd); op_d6();												} /* DB   FD          */
OP(fd,d7) { IllegalOpcode(0xfd); op_d7();												} /* DB   FD          */

OP(fd,d8) { IllegalOpcode(0xfd); op_d8();												} /* DB   FD          */
OP(fd,d9) { IllegalOpcode(0xfd); op_d9();												} /* DB   FD          */
OP(fd,da) { IllegalOpcode(0xfd); op_da();												} /* DB   FD          */
OP(fd,db) { IllegalOpcode(0xfd); op_db();												} /* DB   FD          */
OP(fd,dc) { IllegalOpcode(0xfd); op_dc();												} /* DB   FD          */
OP(fd,dd) { IllegalOpcode(0xfd); op_dd();												} /* DB   FD          */
OP(fd,de) { IllegalOpcode(0xfd); op_de();												} /* DB   FD          */
OP(fd,df) { IllegalOpcode(0xfd); op_df();												} /* DB   FD          */

OP(fd,e0) { IllegalOpcode(0xfd); op_e0();												} /* DB   FD          */
OP(fd,e1) { POP(z80, iy);															} /* POP  IY          */
OP(fd,e2) { IllegalOpcode(0xfd); op_e2();												} /* DB   FD          */
OP(fd,e3) { EXSP(z80, iy);															} /* EX   (SP),IY     */
OP(fd,e4) { IllegalOpcode(0xfd); op_e4();												} /* DB   FD          */
OP(fd,e5) { PUSH(z80, iy);															} /* PUSH IY          */
OP(fd,e6) { IllegalOpcode(0xfd); op_e6();												} /* DB   FD          */
OP(fd,e7) { IllegalOpcode(0xfd); op_e7();												} /* DB   FD          */

OP(fd,e8) { IllegalOpcode(0xfd); op_e8();												} /* DB   FD          */
OP(fd,e9) { PC = IY; 														} /* JP   (IY)        */
OP(fd,ea) { IllegalOpcode(0xfd); op_ea();												} /* DB   FD          */
OP(fd,eb) { IllegalOpcode(0xfd); op_eb();												} /* DB   FD          */
OP(fd,ec) { IllegalOpcode(0xfd); op_ec();												} /* DB   FD          */
OP(fd,ed) { IllegalOpcode(0xfd); op_ed();												} /* DB   FD          */
OP(fd,ee) { IllegalOpcode(0xfd); op_ee();												} /* DB   FD          */
OP(fd,ef) { IllegalOpcode(0xfd); op_ef();												} /* DB   FD          */

OP(fd,f0) { IllegalOpcode(0xfd); op_f0();												} /* DB   FD          */
OP(fd,f1) { IllegalOpcode(0xfd); op_f1();												} /* DB   FD          */
OP(fd,f2) { IllegalOpcode(0xfd); op_f2();												} /* DB   FD          */
OP(fd,f3) { IllegalOpcode(0xfd); op_f3();												} /* DB   FD          */
OP(fd,f4) { IllegalOpcode(0xfd); op_f4();												} /* DB   FD          */
OP(fd,f5) { IllegalOpcode(0xfd); op_f5();												} /* DB   FD          */
OP(fd,f6) { IllegalOpcode(0xfd); op_f6();												} /* DB   FD          */
OP(fd,f7) { IllegalOpcode(0xfd); op_f7();												} /* DB   FD          */

OP(fd,f8) { IllegalOpcode(0xfd); op_f8();												} /* DB   FD          */
OP(fd,f9) { SP = IY;														} /* LD   SP,IY       */
OP(fd,fa) { IllegalOpcode(0xfd); op_fa();												} /* DB   FD          */
OP(fd,fb) { IllegalOpcode(0xfd); op_fb();												} /* DB   FD          */
OP(fd,fc) { IllegalOpcode(0xfd); op_fc();												} /* DB   FD          */
OP(fd,fd) { IllegalOpcode(0xfd); op_fd();												} /* DB   FD          */
OP(fd,fe) { IllegalOpcode(0xfd); op_fe();												} /* DB   FD          */
OP(fd,ff) { IllegalOpcode(0xfd); op_ff();												} /* DB   FD          */

/**********************************************************
 * special opcodes (ED prefix)
 **********************************************************/
OP(ed,00) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,01) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,02) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,03) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,04) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,05) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,06) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,07) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,08) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,09) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,0a) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,0b) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,0c) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,0d) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,0e) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,0f) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,10) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,11) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,12) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,13) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,14) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,15) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,16) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,17) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,18) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,19) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,1a) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,1b) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,1c) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,1d) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,1e) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,1f) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,20) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,21) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,22) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,23) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,24) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,25) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,26) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,27) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,28) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,29) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,2a) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,2b) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,2c) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,2d) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,2e) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,2f) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,30) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,31) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,32) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,33) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,34) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,35) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,36) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,37) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,38) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,39) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,3a) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,3b) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,3c) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,3d) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,3e) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,3f) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,40) { B = IN(Z, BC); F = (F & CF) | SZP[B];					} /* IN   B,(C)       */
OP(ed,41) { OUT(Z, BC, B);											} /* OUT  (C),B       */
OP(ed,42) { SBC16(Z, bc );										} /* SBC  HL,BC       */
OP(ed,43) { EA = ARG16(); WM16( EA, &bc );					} /* LD   (w),BC      */
OP(ed,44) { NEG;												} /* NEG              */
OP(ed,45) { RETN;												} /* RETN;            */
OP(ed,46) { IM = 0;												} /* IM   0           */
OP(ed,47) { LD_I_A;												} /* LD   I,A         */

OP(ed,48) { C = IN(Z,BC); F = (F & CF) | SZP[C];					} /* IN   C,(C)       */
OP(ed,49) { OUT(Z, BC, C);											} /* OUT  (C),C       */
OP(ed,4a) { ADC16( A, bc );										} /* ADC  HL,BC       */
OP(ed,4b) { EA = ARG16(); RM16( EA, &bc );					} /* LD   BC,(w)      */
OP(ed,4c) { NEG;												} /* NEG              */
OP(ed,4d) { RETI;												} /* RETI             */
OP(ed,4e) { IM = 0;												} /* IM   0           */
OP(ed,4f) { LD_R_A;												} /* LD   R,A         */

OP(ed,50) { D = IN(Z,BC); F = (F & CF) | SZP[D];					} /* IN   D,(C)       */
OP(ed,51) { OUT(Z,BC, D);											} /* OUT  (C),D       */
OP(ed,52) { SBC16( Z, de );										} /* SBC  HL,DE       */
OP(ed,53) { EA = ARG16(); WM16( EA, &de );					} /* LD   (w),DE      */
OP(ed,54) { NEG;												} /* NEG              */
OP(ed,55) { RETN;												} /* RETN;            */
OP(ed,56) { IM = 1;												} /* IM   1           */
OP(ed,57) { LD_A_I;												} /* LD   A,I         */

OP(ed,58) { E = IN(Z, BC); F = (F & CF) | SZP[E];					} /* IN   E,(C)       */
OP(ed,59) { OUT(Z, BC, E);											} /* OUT  (C),E       */
OP(ed,5a) { ADC16( Z, de );										} /* ADC  HL,DE       */
OP(ed,5b) { EA = ARG16(); RM16( EA, &de );					} /* LD   DE,(w)      */
OP(ed,5c) { NEG;												} /* NEG              */
OP(ed,5d) { RETI;												} /* RETI             */
OP(ed,5e) { IM = 2;												} /* IM   2           */
OP(ed,5f) { LD_A_R;												} /* LD   A,R         */

OP(ed,60) { H = IN(Z,BC); F = (F & CF) | SZP[H];					} /* IN   H,(C)       */
OP(ed,61) { OUT(Z,BC, H);											} /* OUT  (C),H       */
OP(ed,62) { SBC16( Z,hl );										} /* SBC  HL,HL       */
OP(ed,63) { EA = ARG16(); WM16( EA, &hl );					} /* LD   (w),HL      */
OP(ed,64) { NEG;												} /* NEG              */
OP(ed,65) { RETN;												} /* RETN;            */
OP(ed,66) { IM = 0;												} /* IM   0           */
OP(ed,67) { RRD;												} /* RRD  (HL)        */

OP(ed,68) { L = IN(Z, BC); F = (F & CF) | SZP[L];					} /* IN   L,(C)       */
OP(ed,69) { OUT(Z, BC, L);											} /* OUT  (C),L       */
OP(ed,6a) { ADC16( Z, hl );										} /* ADC  HL,HL       */
OP(ed,6b) { EA = ARG16(); RM16( EA, &hl );					} /* LD   HL,(w)      */
OP(ed,6c) { NEG;												} /* NEG              */
OP(ed,6d) { RETI;												} /* RETI             */
OP(ed,6e) { IM = 0;												} /* IM   0           */
OP(ed,6f) { RLD;												} /* RLD  (HL)        */

OP(ed,70) { UINT8 res = IN(Z, BC); F = (F & CF) | SZP[res];		} /* IN   0,(C)       */
OP(ed,71) { OUT(Z, BC, 0);											} /* OUT  (C),0       */
OP(ed,72) { SBC16( Z, sp );										} /* SBC  HL,SP       */
OP(ed,73) { EA = ARG16(); WM16( EA, &sp );					} /* LD   (w),SP      */
OP(ed,74) { NEG;												} /* NEG              */
OP(ed,75) { RETN;												} /* RETN;            */
OP(ed,76) { IM = 1;												} /* IM   1           */
OP(ed,77) { IllegalOpcode(0xed);										} /* DB   ED,77       */

OP(ed,78) { A = IN(Z,BC); F = (F & CF) | SZP[A];					} /* IN   E,(C)       */
OP(ed,79) { OUT(Z, BC, A);											} /* OUT  (C),A       */
OP(ed,7a) { ADC16( Z, sp );										} /* ADC  HL,SP       */
OP(ed,7b) { EA = ARG16(); RM16( EA, &sp );					} /* LD   SP,(w)      */
OP(ed,7c) { NEG;												} /* NEG              */
OP(ed,7d) { RETI;												} /* RETI             */
OP(ed,7e) { IM = 2;												} /* IM   2           */
OP(ed,7f) { IllegalOpcode(0xed);										} /* DB   ED,7F       */

OP(ed,80) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,81) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,82) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,83) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,84) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,85) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,86) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,87) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,88) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,89) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,8a) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,8b) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,8c) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,8d) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,8e) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,8f) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,90) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,91) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,92) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,93) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,94) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,95) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,96) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,97) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,98) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,99) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,9a) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,9b) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,9c) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,9d) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,9e) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,9f) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,a0) { LDI;												} /* LDI              */
OP(ed,a1) { CPI;												} /* CPI              */
OP(ed,a2) { INI;												} /* INI              */
OP(ed,a3) { OUTI;												} /* OUTI             */
OP(ed,a4) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,a5) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,a6) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,a7) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,a8) { LDD;												} /* LDD              */
OP(ed,a9) { CPD;												} /* CPD              */
OP(ed,aa) { IND;												} /* IND              */
OP(ed,ab) { OUTD;												} /* OUTD             */
OP(ed,ac) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,ad) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,ae) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,af) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,b0) { LDIR;												} /* LDIR             */
OP(ed,b1) { CPIR;												} /* CPIR             */
OP(ed,b2) { INIR;												} /* INIR             */
OP(ed,b3) { OTIR;												} /* OTIR             */
OP(ed,b4) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,b5) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,b6) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,b7) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,b8) { LDDR;												} /* LDDR             */
OP(ed,b9) { CPDR;												} /* CPDR             */
OP(ed,ba) { INDR;												} /* INDR             */
OP(ed,bb) { OTDR;												} /* OTDR             */
OP(ed,bc) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,bd) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,be) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,bf) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,c0) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,c1) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,c2) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,c3) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,c4) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,c5) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,c6) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,c7) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,c8) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,c9) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,ca) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,cb) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,cc) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,cd) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,ce) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,cf) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,d0) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,d1) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,d2) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,d3) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,d4) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,d5) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,d6) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,d7) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,d8) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,d9) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,da) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,db) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,dc) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,dd) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,de) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,df) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,e0) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,e1) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,e2) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,e3) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,e4) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,e5) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,e6) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,e7) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,e8) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,e9) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,ea) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,eb) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,ec) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,ed) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,ee) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,ef) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,f0) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,f1) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,f2) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,f3) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,f4) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,f5) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,f6) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,f7) { IllegalOpcode(0xed);										} /* DB   ED          */

OP(ed,f8) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,f9) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,fa) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,fb) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,fc) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,fd) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,fe) { IllegalOpcode(0xed);										} /* DB   ED          */
OP(ed,ff) { IllegalOpcode(0xed);										} /* DB   ED          */



void CZ80::IllegalOpcode( int prefix ) {
	Msg("Z80: illegal opcode at %p (prefix %2X)\n",PC,prefix);
	Msg("Emulation stopped, press CTRL+C on command line to stop program\n");
	while(1);
}

// CZ80::BuildOptables: builds operand tables.
// This is a *TERRIBLE* way of doing things and is due in for the big core cleanup once this is all working
void CZ80::BuildOptables() {

    void (CZ80::*optable[0x100])() = {
			&CZ80::op_00, &CZ80::op_01, &CZ80::op_02, &CZ80::op_03, &CZ80::op_04, &CZ80::op_05, &CZ80::op_06, &CZ80::op_07, &CZ80::op_08, &CZ80::op_09, &CZ80::op_0a, &CZ80::op_0b, &CZ80::op_0c, &CZ80::op_0d, &CZ80::op_0e, &CZ80::op_0f,
			&CZ80::op_10, &CZ80::op_11, &CZ80::op_12, &CZ80::op_13, &CZ80::op_14, &CZ80::op_15, &CZ80::op_16, &CZ80::op_17, &CZ80::op_18, &CZ80::op_19, &CZ80::op_1a, &CZ80::op_1b, &CZ80::op_1c, &CZ80::op_1d, &CZ80::op_1e, &CZ80::op_1f,
			&CZ80::op_20, &CZ80::op_21, &CZ80::op_22, &CZ80::op_23, &CZ80::op_24, &CZ80::op_25, &CZ80::op_26, &CZ80::op_27, &CZ80::op_28, &CZ80::op_29, &CZ80::op_2a, &CZ80::op_2b, &CZ80::op_2c, &CZ80::op_2d, &CZ80::op_2e, &CZ80::op_2f,
			&CZ80::op_30, &CZ80::op_31, &CZ80::op_32, &CZ80::op_33, &CZ80::op_34, &CZ80::op_35, &CZ80::op_36, &CZ80::op_37, &CZ80::op_38, &CZ80::op_39, &CZ80::op_3a, &CZ80::op_3b, &CZ80::op_3c, &CZ80::op_3d, &CZ80::op_3e, &CZ80::op_3f,
			&CZ80::op_40, &CZ80::op_41, &CZ80::op_42, &CZ80::op_43, &CZ80::op_44, &CZ80::op_45, &CZ80::op_46, &CZ80::op_47, &CZ80::op_48, &CZ80::op_49, &CZ80::op_4a, &CZ80::op_4b, &CZ80::op_4c, &CZ80::op_4d, &CZ80::op_4e, &CZ80::op_4f,
			&CZ80::op_50, &CZ80::op_51, &CZ80::op_52, &CZ80::op_53, &CZ80::op_54, &CZ80::op_55, &CZ80::op_56, &CZ80::op_57, &CZ80::op_58, &CZ80::op_59, &CZ80::op_5a, &CZ80::op_5b, &CZ80::op_5c, &CZ80::op_5d, &CZ80::op_5e, &CZ80::op_5f,
			&CZ80::op_60, &CZ80::op_61, &CZ80::op_62, &CZ80::op_63, &CZ80::op_64, &CZ80::op_65, &CZ80::op_66, &CZ80::op_67, &CZ80::op_68, &CZ80::op_69, &CZ80::op_6a, &CZ80::op_6b, &CZ80::op_6c, &CZ80::op_6d, &CZ80::op_6e, &CZ80::op_6f,
			&CZ80::op_70, &CZ80::op_71, &CZ80::op_72, &CZ80::op_73, &CZ80::op_74, &CZ80::op_75, &CZ80::op_76, &CZ80::op_77, &CZ80::op_78, &CZ80::op_79, &CZ80::op_7a, &CZ80::op_7b, &CZ80::op_7c, &CZ80::op_7d, &CZ80::op_7e, &CZ80::op_7f,
			&CZ80::op_80, &CZ80::op_81, &CZ80::op_82, &CZ80::op_83, &CZ80::op_84, &CZ80::op_85, &CZ80::op_86, &CZ80::op_87, &CZ80::op_88, &CZ80::op_89, &CZ80::op_8a, &CZ80::op_8b, &CZ80::op_8c, &CZ80::op_8d, &CZ80::op_8e, &CZ80::op_8f,
			&CZ80::op_90, &CZ80::op_91, &CZ80::op_92, &CZ80::op_93, &CZ80::op_94, &CZ80::op_95, &CZ80::op_96, &CZ80::op_97, &CZ80::op_98, &CZ80::op_99, &CZ80::op_9a, &CZ80::op_9b, &CZ80::op_9c, &CZ80::op_9d, &CZ80::op_9e, &CZ80::op_9f,
			&CZ80::op_a0, &CZ80::op_a1, &CZ80::op_a2, &CZ80::op_a3, &CZ80::op_a4, &CZ80::op_a5, &CZ80::op_a6, &CZ80::op_a7, &CZ80::op_a8, &CZ80::op_a9, &CZ80::op_aa, &CZ80::op_ab, &CZ80::op_ac, &CZ80::op_ad, &CZ80::op_ae, &CZ80::op_af,
			&CZ80::op_b0, &CZ80::op_b1, &CZ80::op_b2, &CZ80::op_b3, &CZ80::op_b4, &CZ80::op_b5, &CZ80::op_b6, &CZ80::op_b7, &CZ80::op_b8, &CZ80::op_b9, &CZ80::op_ba, &CZ80::op_bb, &CZ80::op_bc, &CZ80::op_bd, &CZ80::op_be, &CZ80::op_bf,
			&CZ80::op_c0, &CZ80::op_c1, &CZ80::op_c2, &CZ80::op_c3, &CZ80::op_c4, &CZ80::op_c5, &CZ80::op_c6, &CZ80::op_c7, &CZ80::op_c8, &CZ80::op_c9, &CZ80::op_ca, &CZ80::op_cb, &CZ80::op_cc, &CZ80::op_cd, &CZ80::op_ce, &CZ80::op_cf,
			&CZ80::op_d0, &CZ80::op_d1, &CZ80::op_d2, &CZ80::op_d3, &CZ80::op_d4, &CZ80::op_d5, &CZ80::op_d6, &CZ80::op_d7, &CZ80::op_d8, &CZ80::op_d9, &CZ80::op_da, &CZ80::op_db, &CZ80::op_dc, &CZ80::op_dd, &CZ80::op_de, &CZ80::op_df,
			&CZ80::op_e0, &CZ80::op_e1, &CZ80::op_e2, &CZ80::op_e3, &CZ80::op_e4, &CZ80::op_e5, &CZ80::op_e6, &CZ80::op_e7, &CZ80::op_e8, &CZ80::op_e9, &CZ80::op_ea, &CZ80::op_eb, &CZ80::op_ec, &CZ80::op_ed, &CZ80::op_ee, &CZ80::op_ef,
			&CZ80::op_f0, &CZ80::op_f1, &CZ80::op_f2, &CZ80::op_f3, &CZ80::op_f4, &CZ80::op_f5, &CZ80::op_f6, &CZ80::op_f7, &CZ80::op_f8, &CZ80::op_f9, &CZ80::op_fa, &CZ80::op_fb, &CZ80::op_fc, &CZ80::op_fd, &CZ80::op_fe, &CZ80::op_ff,
	};

	void (CZ80::*xycbtable[0x100])() = {
		&CZ80::xycb_00, &CZ80::xycb_01, &CZ80::xycb_02, &CZ80::xycb_03, &CZ80::xycb_04, &CZ80::xycb_05, &CZ80::xycb_06, &CZ80::xycb_07, &CZ80::xycb_08, &CZ80::xycb_09, &CZ80::xycb_0a, &CZ80::xycb_0b, &CZ80::xycb_0c, &CZ80::xycb_0d, &CZ80::xycb_0e, &CZ80::xycb_0f, 
		&CZ80::xycb_10, &CZ80::xycb_11, &CZ80::xycb_12, &CZ80::xycb_13, &CZ80::xycb_14, &CZ80::xycb_15, &CZ80::xycb_16, &CZ80::xycb_17, &CZ80::xycb_18, &CZ80::xycb_19, &CZ80::xycb_1a, &CZ80::xycb_1b, &CZ80::xycb_1c, &CZ80::xycb_1d, &CZ80::xycb_1e, &CZ80::xycb_1f, 
		&CZ80::xycb_20, &CZ80::xycb_21, &CZ80::xycb_22, &CZ80::xycb_23, &CZ80::xycb_24, &CZ80::xycb_25, &CZ80::xycb_26, &CZ80::xycb_27, &CZ80::xycb_28, &CZ80::xycb_29, &CZ80::xycb_2a, &CZ80::xycb_2b, &CZ80::xycb_2c, &CZ80::xycb_2d, &CZ80::xycb_2e, &CZ80::xycb_2f, 
		&CZ80::xycb_30, &CZ80::xycb_31, &CZ80::xycb_32, &CZ80::xycb_33, &CZ80::xycb_34, &CZ80::xycb_35, &CZ80::xycb_36, &CZ80::xycb_37, &CZ80::xycb_38, &CZ80::xycb_39, &CZ80::xycb_3a, &CZ80::xycb_3b, &CZ80::xycb_3c, &CZ80::xycb_3d, &CZ80::xycb_3e, &CZ80::xycb_3f, 
		&CZ80::xycb_40, &CZ80::xycb_41, &CZ80::xycb_42, &CZ80::xycb_43, &CZ80::xycb_44, &CZ80::xycb_45, &CZ80::xycb_46, &CZ80::xycb_47, &CZ80::xycb_48, &CZ80::xycb_49, &CZ80::xycb_4a, &CZ80::xycb_4b, &CZ80::xycb_4c, &CZ80::xycb_4d, &CZ80::xycb_4e, &CZ80::xycb_4f, 
		&CZ80::xycb_50, &CZ80::xycb_51, &CZ80::xycb_52, &CZ80::xycb_53, &CZ80::xycb_54, &CZ80::xycb_55, &CZ80::xycb_56, &CZ80::xycb_57, &CZ80::xycb_58, &CZ80::xycb_59, &CZ80::xycb_5a, &CZ80::xycb_5b, &CZ80::xycb_5c, &CZ80::xycb_5d, &CZ80::xycb_5e, &CZ80::xycb_5f, 
		&CZ80::xycb_60, &CZ80::xycb_61, &CZ80::xycb_62, &CZ80::xycb_63, &CZ80::xycb_64, &CZ80::xycb_65, &CZ80::xycb_66, &CZ80::xycb_67, &CZ80::xycb_68, &CZ80::xycb_69, &CZ80::xycb_6a, &CZ80::xycb_6b, &CZ80::xycb_6c, &CZ80::xycb_6d, &CZ80::xycb_6e, &CZ80::xycb_6f, 
		&CZ80::xycb_70, &CZ80::xycb_71, &CZ80::xycb_72, &CZ80::xycb_73, &CZ80::xycb_74, &CZ80::xycb_75, &CZ80::xycb_76, &CZ80::xycb_77, &CZ80::xycb_78, &CZ80::xycb_79, &CZ80::xycb_7a, &CZ80::xycb_7b, &CZ80::xycb_7c, &CZ80::xycb_7d, &CZ80::xycb_7e, &CZ80::xycb_7f, 
		&CZ80::xycb_80, &CZ80::xycb_81, &CZ80::xycb_82, &CZ80::xycb_83, &CZ80::xycb_84, &CZ80::xycb_85, &CZ80::xycb_86, &CZ80::xycb_87, &CZ80::xycb_88, &CZ80::xycb_89, &CZ80::xycb_8a, &CZ80::xycb_8b, &CZ80::xycb_8c, &CZ80::xycb_8d, &CZ80::xycb_8e, &CZ80::xycb_8f, 
		&CZ80::xycb_90, &CZ80::xycb_91, &CZ80::xycb_92, &CZ80::xycb_93, &CZ80::xycb_94, &CZ80::xycb_95, &CZ80::xycb_96, &CZ80::xycb_97, &CZ80::xycb_98, &CZ80::xycb_99, &CZ80::xycb_9a, &CZ80::xycb_9b, &CZ80::xycb_9c, &CZ80::xycb_9d, &CZ80::xycb_9e, &CZ80::xycb_9f, 
		&CZ80::xycb_a0, &CZ80::xycb_a1, &CZ80::xycb_a2, &CZ80::xycb_a3, &CZ80::xycb_a4, &CZ80::xycb_a5, &CZ80::xycb_a6, &CZ80::xycb_a7, &CZ80::xycb_a8, &CZ80::xycb_a9, &CZ80::xycb_aa, &CZ80::xycb_ab, &CZ80::xycb_ac, &CZ80::xycb_ad, &CZ80::xycb_ae, &CZ80::xycb_af, 
		&CZ80::xycb_b0, &CZ80::xycb_b1, &CZ80::xycb_b2, &CZ80::xycb_b3, &CZ80::xycb_b4, &CZ80::xycb_b5, &CZ80::xycb_b6, &CZ80::xycb_b7, &CZ80::xycb_b8, &CZ80::xycb_b9, &CZ80::xycb_ba, &CZ80::xycb_bb, &CZ80::xycb_bc, &CZ80::xycb_bd, &CZ80::xycb_be, &CZ80::xycb_bf, 
		&CZ80::xycb_c0, &CZ80::xycb_c1, &CZ80::xycb_c2, &CZ80::xycb_c3, &CZ80::xycb_c4, &CZ80::xycb_c5, &CZ80::xycb_c6, &CZ80::xycb_c7, &CZ80::xycb_c8, &CZ80::xycb_c9, &CZ80::xycb_ca, &CZ80::xycb_cb, &CZ80::xycb_cc, &CZ80::xycb_cd, &CZ80::xycb_ce, &CZ80::xycb_cf, 
		&CZ80::xycb_d0, &CZ80::xycb_d1, &CZ80::xycb_d2, &CZ80::xycb_d3, &CZ80::xycb_d4, &CZ80::xycb_d5, &CZ80::xycb_d6, &CZ80::xycb_d7, &CZ80::xycb_d8, &CZ80::xycb_d9, &CZ80::xycb_da, &CZ80::xycb_db, &CZ80::xycb_dc, &CZ80::xycb_dd, &CZ80::xycb_de, &CZ80::xycb_df, 
		&CZ80::xycb_e0, &CZ80::xycb_e1, &CZ80::xycb_e2, &CZ80::xycb_e3, &CZ80::xycb_e4, &CZ80::xycb_e5, &CZ80::xycb_e6, &CZ80::xycb_e7, &CZ80::xycb_e8, &CZ80::xycb_e9, &CZ80::xycb_ea, &CZ80::xycb_eb, &CZ80::xycb_ec, &CZ80::xycb_ed, &CZ80::xycb_ee, &CZ80::xycb_ef, 
		&CZ80::xycb_f0, &CZ80::xycb_f1, &CZ80::xycb_f2, &CZ80::xycb_f3, &CZ80::xycb_f4, &CZ80::xycb_f5, &CZ80::xycb_f6, &CZ80::xycb_f7, &CZ80::xycb_f8, &CZ80::xycb_f9, &CZ80::xycb_fa, &CZ80::xycb_fb, &CZ80::xycb_fc, &CZ80::xycb_fd, &CZ80::xycb_fe, &CZ80::xycb_ff, 
	};

	void (CZ80::*cbtable[0x100])() = {
		&CZ80::cb_00, &CZ80::cb_01, &CZ80::cb_02, &CZ80::cb_03, &CZ80::cb_04, &CZ80::cb_05, &CZ80::cb_06, &CZ80::cb_07, &CZ80::cb_08, &CZ80::cb_09, &CZ80::cb_0a, &CZ80::cb_0b, &CZ80::cb_0c, &CZ80::cb_0d, &CZ80::cb_0e, &CZ80::cb_0f, 
		&CZ80::cb_10, &CZ80::cb_11, &CZ80::cb_12, &CZ80::cb_13, &CZ80::cb_14, &CZ80::cb_15, &CZ80::cb_16, &CZ80::cb_17, &CZ80::cb_18, &CZ80::cb_19, &CZ80::cb_1a, &CZ80::cb_1b, &CZ80::cb_1c, &CZ80::cb_1d, &CZ80::cb_1e, &CZ80::cb_1f, 
		&CZ80::cb_20, &CZ80::cb_21, &CZ80::cb_22, &CZ80::cb_23, &CZ80::cb_24, &CZ80::cb_25, &CZ80::cb_26, &CZ80::cb_27, &CZ80::cb_28, &CZ80::cb_29, &CZ80::cb_2a, &CZ80::cb_2b, &CZ80::cb_2c, &CZ80::cb_2d, &CZ80::cb_2e, &CZ80::cb_2f, 
		&CZ80::cb_30, &CZ80::cb_31, &CZ80::cb_32, &CZ80::cb_33, &CZ80::cb_34, &CZ80::cb_35, &CZ80::cb_36, &CZ80::cb_37, &CZ80::cb_38, &CZ80::cb_39, &CZ80::cb_3a, &CZ80::cb_3b, &CZ80::cb_3c, &CZ80::cb_3d, &CZ80::cb_3e, &CZ80::cb_3f, 
		&CZ80::cb_40, &CZ80::cb_41, &CZ80::cb_42, &CZ80::cb_43, &CZ80::cb_44, &CZ80::cb_45, &CZ80::cb_46, &CZ80::cb_47, &CZ80::cb_48, &CZ80::cb_49, &CZ80::cb_4a, &CZ80::cb_4b, &CZ80::cb_4c, &CZ80::cb_4d, &CZ80::cb_4e, &CZ80::cb_4f, 
		&CZ80::cb_50, &CZ80::cb_51, &CZ80::cb_52, &CZ80::cb_53, &CZ80::cb_54, &CZ80::cb_55, &CZ80::cb_56, &CZ80::cb_57, &CZ80::cb_58, &CZ80::cb_59, &CZ80::cb_5a, &CZ80::cb_5b, &CZ80::cb_5c, &CZ80::cb_5d, &CZ80::cb_5e, &CZ80::cb_5f, 
		&CZ80::cb_60, &CZ80::cb_61, &CZ80::cb_62, &CZ80::cb_63, &CZ80::cb_64, &CZ80::cb_65, &CZ80::cb_66, &CZ80::cb_67, &CZ80::cb_68, &CZ80::cb_69, &CZ80::cb_6a, &CZ80::cb_6b, &CZ80::cb_6c, &CZ80::cb_6d, &CZ80::cb_6e, &CZ80::cb_6f, 
		&CZ80::cb_70, &CZ80::cb_71, &CZ80::cb_72, &CZ80::cb_73, &CZ80::cb_74, &CZ80::cb_75, &CZ80::cb_76, &CZ80::cb_77, &CZ80::cb_78, &CZ80::cb_79, &CZ80::cb_7a, &CZ80::cb_7b, &CZ80::cb_7c, &CZ80::cb_7d, &CZ80::cb_7e, &CZ80::cb_7f, 
		&CZ80::cb_80, &CZ80::cb_81, &CZ80::cb_82, &CZ80::cb_83, &CZ80::cb_84, &CZ80::cb_85, &CZ80::cb_86, &CZ80::cb_87, &CZ80::cb_88, &CZ80::cb_89, &CZ80::cb_8a, &CZ80::cb_8b, &CZ80::cb_8c, &CZ80::cb_8d, &CZ80::cb_8e, &CZ80::cb_8f, 
		&CZ80::cb_90, &CZ80::cb_91, &CZ80::cb_92, &CZ80::cb_93, &CZ80::cb_94, &CZ80::cb_95, &CZ80::cb_96, &CZ80::cb_97, &CZ80::cb_98, &CZ80::cb_99, &CZ80::cb_9a, &CZ80::cb_9b, &CZ80::cb_9c, &CZ80::cb_9d, &CZ80::cb_9e, &CZ80::cb_9f, 
		&CZ80::cb_a0, &CZ80::cb_a1, &CZ80::cb_a2, &CZ80::cb_a3, &CZ80::cb_a4, &CZ80::cb_a5, &CZ80::cb_a6, &CZ80::cb_a7, &CZ80::cb_a8, &CZ80::cb_a9, &CZ80::cb_aa, &CZ80::cb_ab, &CZ80::cb_ac, &CZ80::cb_ad, &CZ80::cb_ae, &CZ80::cb_af, 
		&CZ80::cb_b0, &CZ80::cb_b1, &CZ80::cb_b2, &CZ80::cb_b3, &CZ80::cb_b4, &CZ80::cb_b5, &CZ80::cb_b6, &CZ80::cb_b7, &CZ80::cb_b8, &CZ80::cb_b9, &CZ80::cb_ba, &CZ80::cb_bb, &CZ80::cb_bc, &CZ80::cb_bd, &CZ80::cb_be, &CZ80::cb_bf, 
		&CZ80::cb_c0, &CZ80::cb_c1, &CZ80::cb_c2, &CZ80::cb_c3, &CZ80::cb_c4, &CZ80::cb_c5, &CZ80::cb_c6, &CZ80::cb_c7, &CZ80::cb_c8, &CZ80::cb_c9, &CZ80::cb_ca, &CZ80::cb_cb, &CZ80::cb_cc, &CZ80::cb_cd, &CZ80::cb_ce, &CZ80::cb_cf, 
		&CZ80::cb_d0, &CZ80::cb_d1, &CZ80::cb_d2, &CZ80::cb_d3, &CZ80::cb_d4, &CZ80::cb_d5, &CZ80::cb_d6, &CZ80::cb_d7, &CZ80::cb_d8, &CZ80::cb_d9, &CZ80::cb_da, &CZ80::cb_db, &CZ80::cb_dc, &CZ80::cb_dd, &CZ80::cb_de, &CZ80::cb_df, 
		&CZ80::cb_e0, &CZ80::cb_e1, &CZ80::cb_e2, &CZ80::cb_e3, &CZ80::cb_e4, &CZ80::cb_e5, &CZ80::cb_e6, &CZ80::cb_e7, &CZ80::cb_e8, &CZ80::cb_e9, &CZ80::cb_ea, &CZ80::cb_eb, &CZ80::cb_ec, &CZ80::cb_ed, &CZ80::cb_ee, &CZ80::cb_ef, 
		&CZ80::cb_f0, &CZ80::cb_f1, &CZ80::cb_f2, &CZ80::cb_f3, &CZ80::cb_f4, &CZ80::cb_f5, &CZ80::cb_f6, &CZ80::cb_f7, &CZ80::cb_f8, &CZ80::cb_f9, &CZ80::cb_fa, &CZ80::cb_fb, &CZ80::cb_fc, &CZ80::cb_fd, &CZ80::cb_fe, &CZ80::cb_ff, 
	};

	void (CZ80::*ddtable[0x100])() = {
		&CZ80::dd_00, &CZ80::dd_01, &CZ80::dd_02, &CZ80::dd_03, &CZ80::dd_04, &CZ80::dd_05, &CZ80::dd_06, &CZ80::dd_07, &CZ80::dd_08, &CZ80::dd_09, &CZ80::dd_0a, &CZ80::dd_0b, &CZ80::dd_0c, &CZ80::dd_0d, &CZ80::dd_0e, &CZ80::dd_0f, 
		&CZ80::dd_10, &CZ80::dd_11, &CZ80::dd_12, &CZ80::dd_13, &CZ80::dd_14, &CZ80::dd_15, &CZ80::dd_16, &CZ80::dd_17, &CZ80::dd_18, &CZ80::dd_19, &CZ80::dd_1a, &CZ80::dd_1b, &CZ80::dd_1c, &CZ80::dd_1d, &CZ80::dd_1e, &CZ80::dd_1f, 
		&CZ80::dd_20, &CZ80::dd_21, &CZ80::dd_22, &CZ80::dd_23, &CZ80::dd_24, &CZ80::dd_25, &CZ80::dd_26, &CZ80::dd_27, &CZ80::dd_28, &CZ80::dd_29, &CZ80::dd_2a, &CZ80::dd_2b, &CZ80::dd_2c, &CZ80::dd_2d, &CZ80::dd_2e, &CZ80::dd_2f, 
		&CZ80::dd_30, &CZ80::dd_31, &CZ80::dd_32, &CZ80::dd_33, &CZ80::dd_34, &CZ80::dd_35, &CZ80::dd_36, &CZ80::dd_37, &CZ80::dd_38, &CZ80::dd_39, &CZ80::dd_3a, &CZ80::dd_3b, &CZ80::dd_3c, &CZ80::dd_3d, &CZ80::dd_3e, &CZ80::dd_3f, 
		&CZ80::dd_40, &CZ80::dd_41, &CZ80::dd_42, &CZ80::dd_43, &CZ80::dd_44, &CZ80::dd_45, &CZ80::dd_46, &CZ80::dd_47, &CZ80::dd_48, &CZ80::dd_49, &CZ80::dd_4a, &CZ80::dd_4b, &CZ80::dd_4c, &CZ80::dd_4d, &CZ80::dd_4e, &CZ80::dd_4f, 
		&CZ80::dd_50, &CZ80::dd_51, &CZ80::dd_52, &CZ80::dd_53, &CZ80::dd_54, &CZ80::dd_55, &CZ80::dd_56, &CZ80::dd_57, &CZ80::dd_58, &CZ80::dd_59, &CZ80::dd_5a, &CZ80::dd_5b, &CZ80::dd_5c, &CZ80::dd_5d, &CZ80::dd_5e, &CZ80::dd_5f, 
		&CZ80::dd_60, &CZ80::dd_61, &CZ80::dd_62, &CZ80::dd_63, &CZ80::dd_64, &CZ80::dd_65, &CZ80::dd_66, &CZ80::dd_67, &CZ80::dd_68, &CZ80::dd_69, &CZ80::dd_6a, &CZ80::dd_6b, &CZ80::dd_6c, &CZ80::dd_6d, &CZ80::dd_6e, &CZ80::dd_6f, 
		&CZ80::dd_70, &CZ80::dd_71, &CZ80::dd_72, &CZ80::dd_73, &CZ80::dd_74, &CZ80::dd_75, &CZ80::dd_76, &CZ80::dd_77, &CZ80::dd_78, &CZ80::dd_79, &CZ80::dd_7a, &CZ80::dd_7b, &CZ80::dd_7c, &CZ80::dd_7d, &CZ80::dd_7e, &CZ80::dd_7f, 
		&CZ80::dd_80, &CZ80::dd_81, &CZ80::dd_82, &CZ80::dd_83, &CZ80::dd_84, &CZ80::dd_85, &CZ80::dd_86, &CZ80::dd_87, &CZ80::dd_88, &CZ80::dd_89, &CZ80::dd_8a, &CZ80::dd_8b, &CZ80::dd_8c, &CZ80::dd_8d, &CZ80::dd_8e, &CZ80::dd_8f, 
		&CZ80::dd_90, &CZ80::dd_91, &CZ80::dd_92, &CZ80::dd_93, &CZ80::dd_94, &CZ80::dd_95, &CZ80::dd_96, &CZ80::dd_97, &CZ80::dd_98, &CZ80::dd_99, &CZ80::dd_9a, &CZ80::dd_9b, &CZ80::dd_9c, &CZ80::dd_9d, &CZ80::dd_9e, &CZ80::dd_9f, 
		&CZ80::dd_a0, &CZ80::dd_a1, &CZ80::dd_a2, &CZ80::dd_a3, &CZ80::dd_a4, &CZ80::dd_a5, &CZ80::dd_a6, &CZ80::dd_a7, &CZ80::dd_a8, &CZ80::dd_a9, &CZ80::dd_aa, &CZ80::dd_ab, &CZ80::dd_ac, &CZ80::dd_ad, &CZ80::dd_ae, &CZ80::dd_af, 
		&CZ80::dd_b0, &CZ80::dd_b1, &CZ80::dd_b2, &CZ80::dd_b3, &CZ80::dd_b4, &CZ80::dd_b5, &CZ80::dd_b6, &CZ80::dd_b7, &CZ80::dd_b8, &CZ80::dd_b9, &CZ80::dd_ba, &CZ80::dd_bb, &CZ80::dd_bc, &CZ80::dd_bd, &CZ80::dd_be, &CZ80::dd_bf, 
		&CZ80::dd_c0, &CZ80::dd_c1, &CZ80::dd_c2, &CZ80::dd_c3, &CZ80::dd_c4, &CZ80::dd_c5, &CZ80::dd_c6, &CZ80::dd_c7, &CZ80::dd_c8, &CZ80::dd_c9, &CZ80::dd_ca, &CZ80::dd_cb, &CZ80::dd_cc, &CZ80::dd_cd, &CZ80::dd_ce, &CZ80::dd_cf, 
		&CZ80::dd_d0, &CZ80::dd_d1, &CZ80::dd_d2, &CZ80::dd_d3, &CZ80::dd_d4, &CZ80::dd_d5, &CZ80::dd_d6, &CZ80::dd_d7, &CZ80::dd_d8, &CZ80::dd_d9, &CZ80::dd_da, &CZ80::dd_db, &CZ80::dd_dc, &CZ80::dd_dd, &CZ80::dd_de, &CZ80::dd_df, 
		&CZ80::dd_e0, &CZ80::dd_e1, &CZ80::dd_e2, &CZ80::dd_e3, &CZ80::dd_e4, &CZ80::dd_e5, &CZ80::dd_e6, &CZ80::dd_e7, &CZ80::dd_e8, &CZ80::dd_e9, &CZ80::dd_ea, &CZ80::dd_eb, &CZ80::dd_ec, &CZ80::dd_ed, &CZ80::dd_ee, &CZ80::dd_ef, 
		&CZ80::dd_f0, &CZ80::dd_f1, &CZ80::dd_f2, &CZ80::dd_f3, &CZ80::dd_f4, &CZ80::dd_f5, &CZ80::dd_f6, &CZ80::dd_f7, &CZ80::dd_f8, &CZ80::dd_f9, &CZ80::dd_fa, &CZ80::dd_fb, &CZ80::dd_fc, &CZ80::dd_fd, &CZ80::dd_fe, &CZ80::dd_ff, 
	};

	void (CZ80::*edtable[0x100])() = {
		&CZ80::ed_00, &CZ80::ed_01, &CZ80::ed_02, &CZ80::ed_03, &CZ80::ed_04, &CZ80::ed_05, &CZ80::ed_06, &CZ80::ed_07, &CZ80::ed_08, &CZ80::ed_09, &CZ80::ed_0a, &CZ80::ed_0b, &CZ80::ed_0c, &CZ80::ed_0d, &CZ80::ed_0e, &CZ80::ed_0f, 
		&CZ80::ed_10, &CZ80::ed_11, &CZ80::ed_12, &CZ80::ed_13, &CZ80::ed_14, &CZ80::ed_15, &CZ80::ed_16, &CZ80::ed_17, &CZ80::ed_18, &CZ80::ed_19, &CZ80::ed_1a, &CZ80::ed_1b, &CZ80::ed_1c, &CZ80::ed_1d, &CZ80::ed_1e, &CZ80::ed_1f, 
		&CZ80::ed_20, &CZ80::ed_21, &CZ80::ed_22, &CZ80::ed_23, &CZ80::ed_24, &CZ80::ed_25, &CZ80::ed_26, &CZ80::ed_27, &CZ80::ed_28, &CZ80::ed_29, &CZ80::ed_2a, &CZ80::ed_2b, &CZ80::ed_2c, &CZ80::ed_2d, &CZ80::ed_2e, &CZ80::ed_2f, 
		&CZ80::ed_30, &CZ80::ed_31, &CZ80::ed_32, &CZ80::ed_33, &CZ80::ed_34, &CZ80::ed_35, &CZ80::ed_36, &CZ80::ed_37, &CZ80::ed_38, &CZ80::ed_39, &CZ80::ed_3a, &CZ80::ed_3b, &CZ80::ed_3c, &CZ80::ed_3d, &CZ80::ed_3e, &CZ80::ed_3f, 
		&CZ80::ed_40, &CZ80::ed_41, &CZ80::ed_42, &CZ80::ed_43, &CZ80::ed_44, &CZ80::ed_45, &CZ80::ed_46, &CZ80::ed_47, &CZ80::ed_48, &CZ80::ed_49, &CZ80::ed_4a, &CZ80::ed_4b, &CZ80::ed_4c, &CZ80::ed_4d, &CZ80::ed_4e, &CZ80::ed_4f, 
		&CZ80::ed_50, &CZ80::ed_51, &CZ80::ed_52, &CZ80::ed_53, &CZ80::ed_54, &CZ80::ed_55, &CZ80::ed_56, &CZ80::ed_57, &CZ80::ed_58, &CZ80::ed_59, &CZ80::ed_5a, &CZ80::ed_5b, &CZ80::ed_5c, &CZ80::ed_5d, &CZ80::ed_5e, &CZ80::ed_5f, 
		&CZ80::ed_60, &CZ80::ed_61, &CZ80::ed_62, &CZ80::ed_63, &CZ80::ed_64, &CZ80::ed_65, &CZ80::ed_66, &CZ80::ed_67, &CZ80::ed_68, &CZ80::ed_69, &CZ80::ed_6a, &CZ80::ed_6b, &CZ80::ed_6c, &CZ80::ed_6d, &CZ80::ed_6e, &CZ80::ed_6f, 
		&CZ80::ed_70, &CZ80::ed_71, &CZ80::ed_72, &CZ80::ed_73, &CZ80::ed_74, &CZ80::ed_75, &CZ80::ed_76, &CZ80::ed_77, &CZ80::ed_78, &CZ80::ed_79, &CZ80::ed_7a, &CZ80::ed_7b, &CZ80::ed_7c, &CZ80::ed_7d, &CZ80::ed_7e, &CZ80::ed_7f, 
		&CZ80::ed_80, &CZ80::ed_81, &CZ80::ed_82, &CZ80::ed_83, &CZ80::ed_84, &CZ80::ed_85, &CZ80::ed_86, &CZ80::ed_87, &CZ80::ed_88, &CZ80::ed_89, &CZ80::ed_8a, &CZ80::ed_8b, &CZ80::ed_8c, &CZ80::ed_8d, &CZ80::ed_8e, &CZ80::ed_8f, 
		&CZ80::ed_90, &CZ80::ed_91, &CZ80::ed_92, &CZ80::ed_93, &CZ80::ed_94, &CZ80::ed_95, &CZ80::ed_96, &CZ80::ed_97, &CZ80::ed_98, &CZ80::ed_99, &CZ80::ed_9a, &CZ80::ed_9b, &CZ80::ed_9c, &CZ80::ed_9d, &CZ80::ed_9e, &CZ80::ed_9f, 
		&CZ80::ed_a0, &CZ80::ed_a1, &CZ80::ed_a2, &CZ80::ed_a3, &CZ80::ed_a4, &CZ80::ed_a5, &CZ80::ed_a6, &CZ80::ed_a7, &CZ80::ed_a8, &CZ80::ed_a9, &CZ80::ed_aa, &CZ80::ed_ab, &CZ80::ed_ac, &CZ80::ed_ad, &CZ80::ed_ae, &CZ80::ed_af, 
		&CZ80::ed_b0, &CZ80::ed_b1, &CZ80::ed_b2, &CZ80::ed_b3, &CZ80::ed_b4, &CZ80::ed_b5, &CZ80::ed_b6, &CZ80::ed_b7, &CZ80::ed_b8, &CZ80::ed_b9, &CZ80::ed_ba, &CZ80::ed_bb, &CZ80::ed_bc, &CZ80::ed_bd, &CZ80::ed_be, &CZ80::ed_bf, 
		&CZ80::ed_c0, &CZ80::ed_c1, &CZ80::ed_c2, &CZ80::ed_c3, &CZ80::ed_c4, &CZ80::ed_c5, &CZ80::ed_c6, &CZ80::ed_c7, &CZ80::ed_c8, &CZ80::ed_c9, &CZ80::ed_ca, &CZ80::ed_ed, &CZ80::ed_cc, &CZ80::ed_cd, &CZ80::ed_ce, &CZ80::ed_cf, 
		&CZ80::ed_d0, &CZ80::ed_d1, &CZ80::ed_d2, &CZ80::ed_d3, &CZ80::ed_d4, &CZ80::ed_d5, &CZ80::ed_d6, &CZ80::ed_d7, &CZ80::ed_d8, &CZ80::ed_d9, &CZ80::ed_da, &CZ80::ed_db, &CZ80::ed_dc, &CZ80::ed_dd, &CZ80::ed_de, &CZ80::ed_df, 
		&CZ80::ed_e0, &CZ80::ed_e1, &CZ80::ed_e2, &CZ80::ed_e3, &CZ80::ed_e4, &CZ80::ed_e5, &CZ80::ed_e6, &CZ80::ed_e7, &CZ80::ed_e8, &CZ80::ed_e9, &CZ80::ed_ea, &CZ80::ed_eb, &CZ80::ed_ec, &CZ80::ed_ed, &CZ80::ed_ee, &CZ80::ed_ef, 
		&CZ80::ed_f0, &CZ80::ed_f1, &CZ80::ed_f2, &CZ80::ed_f3, &CZ80::ed_f4, &CZ80::ed_f5, &CZ80::ed_f6, &CZ80::ed_f7, &CZ80::ed_f8, &CZ80::ed_f9, &CZ80::ed_fa, &CZ80::ed_fb, &CZ80::ed_fc, &CZ80::ed_fd, &CZ80::ed_fe, &CZ80::ed_ff, 
	};

	void (CZ80::*fdtable[0x100])() = {
		&CZ80::fd_00, &CZ80::fd_01, &CZ80::fd_02, &CZ80::fd_03, &CZ80::fd_04, &CZ80::fd_05, &CZ80::fd_06, &CZ80::fd_07, &CZ80::fd_08, &CZ80::fd_09, &CZ80::fd_0a, &CZ80::fd_0b, &CZ80::fd_0c, &CZ80::fd_0d, &CZ80::fd_0e, &CZ80::fd_0f, 
		&CZ80::fd_10, &CZ80::fd_11, &CZ80::fd_12, &CZ80::fd_13, &CZ80::fd_14, &CZ80::fd_15, &CZ80::fd_16, &CZ80::fd_17, &CZ80::fd_18, &CZ80::fd_19, &CZ80::fd_1a, &CZ80::fd_1b, &CZ80::fd_1c, &CZ80::fd_1d, &CZ80::fd_1e, &CZ80::fd_1f, 
		&CZ80::fd_20, &CZ80::fd_21, &CZ80::fd_22, &CZ80::fd_23, &CZ80::fd_24, &CZ80::fd_25, &CZ80::fd_26, &CZ80::fd_27, &CZ80::fd_28, &CZ80::fd_29, &CZ80::fd_2a, &CZ80::fd_2b, &CZ80::fd_2c, &CZ80::fd_2d, &CZ80::fd_2e, &CZ80::fd_2f, 
		&CZ80::fd_30, &CZ80::fd_31, &CZ80::fd_32, &CZ80::fd_33, &CZ80::fd_34, &CZ80::fd_35, &CZ80::fd_36, &CZ80::fd_37, &CZ80::fd_38, &CZ80::fd_39, &CZ80::fd_3a, &CZ80::fd_3b, &CZ80::fd_3c, &CZ80::fd_3d, &CZ80::fd_3e, &CZ80::fd_3f, 
		&CZ80::fd_40, &CZ80::fd_41, &CZ80::fd_42, &CZ80::fd_43, &CZ80::fd_44, &CZ80::fd_45, &CZ80::fd_46, &CZ80::fd_47, &CZ80::fd_48, &CZ80::fd_49, &CZ80::fd_4a, &CZ80::fd_4b, &CZ80::fd_4c, &CZ80::fd_4d, &CZ80::fd_4e, &CZ80::fd_4f, 
		&CZ80::fd_50, &CZ80::fd_51, &CZ80::fd_52, &CZ80::fd_53, &CZ80::fd_54, &CZ80::fd_55, &CZ80::fd_56, &CZ80::fd_57, &CZ80::fd_58, &CZ80::fd_59, &CZ80::fd_5a, &CZ80::fd_5b, &CZ80::fd_5c, &CZ80::fd_5d, &CZ80::fd_5e, &CZ80::fd_5f, 
		&CZ80::fd_60, &CZ80::fd_61, &CZ80::fd_62, &CZ80::fd_63, &CZ80::fd_64, &CZ80::fd_65, &CZ80::fd_66, &CZ80::fd_67, &CZ80::fd_68, &CZ80::fd_69, &CZ80::fd_6a, &CZ80::fd_6b, &CZ80::fd_6c, &CZ80::fd_6d, &CZ80::fd_6e, &CZ80::fd_6f, 
		&CZ80::fd_70, &CZ80::fd_71, &CZ80::fd_72, &CZ80::fd_73, &CZ80::fd_74, &CZ80::fd_75, &CZ80::fd_76, &CZ80::fd_77, &CZ80::fd_78, &CZ80::fd_79, &CZ80::fd_7a, &CZ80::fd_7b, &CZ80::fd_7c, &CZ80::fd_7d, &CZ80::fd_7e, &CZ80::fd_7f, 
		&CZ80::fd_80, &CZ80::fd_81, &CZ80::fd_82, &CZ80::fd_83, &CZ80::fd_84, &CZ80::fd_85, &CZ80::fd_86, &CZ80::fd_87, &CZ80::fd_88, &CZ80::fd_89, &CZ80::fd_8a, &CZ80::fd_8b, &CZ80::fd_8c, &CZ80::fd_8d, &CZ80::fd_8e, &CZ80::fd_8f, 
		&CZ80::fd_90, &CZ80::fd_91, &CZ80::fd_92, &CZ80::fd_93, &CZ80::fd_94, &CZ80::fd_95, &CZ80::fd_96, &CZ80::fd_97, &CZ80::fd_98, &CZ80::fd_99, &CZ80::fd_9a, &CZ80::fd_9b, &CZ80::fd_9c, &CZ80::fd_9d, &CZ80::fd_9e, &CZ80::fd_9f, 
		&CZ80::fd_a0, &CZ80::fd_a1, &CZ80::fd_a2, &CZ80::fd_a3, &CZ80::fd_a4, &CZ80::fd_a5, &CZ80::fd_a6, &CZ80::fd_a7, &CZ80::fd_a8, &CZ80::fd_a9, &CZ80::fd_aa, &CZ80::fd_ab, &CZ80::fd_ac, &CZ80::fd_ad, &CZ80::fd_ae, &CZ80::fd_af, 
		&CZ80::fd_b0, &CZ80::fd_b1, &CZ80::fd_b2, &CZ80::fd_b3, &CZ80::fd_b4, &CZ80::fd_b5, &CZ80::fd_b6, &CZ80::fd_b7, &CZ80::fd_b8, &CZ80::fd_b9, &CZ80::fd_ba, &CZ80::fd_bb, &CZ80::fd_bc, &CZ80::fd_bd, &CZ80::fd_be, &CZ80::fd_bf, 
		&CZ80::fd_c0, &CZ80::fd_c1, &CZ80::fd_c2, &CZ80::fd_c3, &CZ80::fd_c4, &CZ80::fd_c5, &CZ80::fd_c6, &CZ80::fd_c7, &CZ80::fd_c8, &CZ80::fd_c9, &CZ80::fd_ca, &CZ80::fd_fd, &CZ80::fd_cc, &CZ80::fd_cd, &CZ80::fd_ce, &CZ80::fd_cf, 
		&CZ80::fd_d0, &CZ80::fd_d1, &CZ80::fd_d2, &CZ80::fd_d3, &CZ80::fd_d4, &CZ80::fd_d5, &CZ80::fd_d6, &CZ80::fd_d7, &CZ80::fd_d8, &CZ80::fd_d9, &CZ80::fd_da, &CZ80::fd_db, &CZ80::fd_dc, &CZ80::fd_dd, &CZ80::fd_de, &CZ80::fd_df, 
		&CZ80::fd_e0, &CZ80::fd_e1, &CZ80::fd_e2, &CZ80::fd_e3, &CZ80::fd_e4, &CZ80::fd_e5, &CZ80::fd_e6, &CZ80::fd_e7, &CZ80::fd_e8, &CZ80::fd_e9, &CZ80::fd_ea, &CZ80::fd_eb, &CZ80::fd_ec, &CZ80::fd_fd, &CZ80::fd_ee, &CZ80::fd_ef, 
		&CZ80::fd_f0, &CZ80::fd_f1, &CZ80::fd_f2, &CZ80::fd_f3, &CZ80::fd_f4, &CZ80::fd_f5, &CZ80::fd_f6, &CZ80::fd_f7, &CZ80::fd_f8, &CZ80::fd_f9, &CZ80::fd_fa, &CZ80::fd_fb, &CZ80::fd_fc, &CZ80::fd_fd, &CZ80::fd_fe, &CZ80::fd_ff, 
	};


	// really just initializes this in the class when compiled.
	// TODO: change these to use UINT64 on 64-bit platforms

	memcpy(this->optable, optable, sizeof(optable));
	memcpy(this->xycbtable, xycbtable,sizeof (optable));
	memcpy(this->cbtable, cbtable, sizeof (optable));
	memcpy(this->ddtable, ddtable, sizeof (optable));
	memcpy(this->edtable, edtable, sizeof (optable));
	memcpy(this->fdtable, fdtable, sizeof (optable));
}